ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.03k stars 3k forks source link

Gateway shows file icon for directory called `protocol.ai` instead of directory icon #4617

Open victorb opened 6 years ago

victorb commented 6 years ago

Version information:

go-ipfs version: 0.4.12-
Repo version: 6
System version: amd64/linux
Golang version: go1.9.2

Type:

Bug

Severity:

Low

Description:

When adding a directory that has a link protocol.ai, the gateway shows this directory as a Adobe Illustrator file (I think) rather than a directory.

Steps to reproduce:

$ mkdir test
$ mkdir test/protocol.ai
$ mkdir test/libp2p.io
$ echo "protocol.ai" > test/protocol.ai/index.html
$ echo "libp2p.io" > test/libp2p.io/index.html
$ ipfs add -rQ test
QmQ9C4WiXrPE2NUW8GM3GwXdZudvxzJynMM7XwzBxi3CeX

Looking at the gateway on the test directory (https://ipfs.io/ipfs/QmQ9C4WiXrPE2NUW8GM3GwXdZudvxzJynMM7XwzBxi3CeX) you'll see the following:

image

Notice the protocol.ai link shows some file extension icon instead of the directory icon.

Edit: it still works as a directory though, as you can navigate to https://ipfs.io/ipfs/QmQ9C4WiXrPE2NUW8GM3GwXdZudvxzJynMM7XwzBxi3CeX/protocol.ai/ and see the right output. But the icon for the directory is wrong.

victorb commented 6 years ago

Updated title to be more clear as it still works as a directory, but just the icon is wrong.

djdv commented 6 years ago

https://github.com/ipfs/go-ipfs/pull/4545 https://github.com/ipfs/go-ipfs/issues/4543 probably relevant

djdv commented 6 years ago

I don't know if this should be a separate issue but I noticed the gateway doesn't seem to like uppercase extensions either. icons case

jbenet commented 5 years ago

I noticed this just now-- See: http://talks.benet.ai/2018-07-08-ipfs-dev-meetings -- these are all directories

Stebalien commented 5 years ago

So, the issue is that the directory doesn't store any information about file types (except file names). ls works around this by fetching the root block of every directory entry but that's could cause some performance issues on the gateway.