yandex-cloud / geesefs

Finally, a good FUSE FS implementation over S3
Other
667 stars 44 forks source link

--use-set-content-type works only partially and unpredictably #26

Open FractalizeR opened 2 years ago

FractalizeR commented 2 years ago

Enabled --use-set-content-type when mounting bucket (Bucket is from Yandex Cloud). Bucket versioning enabled. Static website hosting enabled. GeeseFS version geesefs version 0.30.5. Then uploaded files into it using rsync -r --rsync-path="sudo rsync" ~/Downloads/cc-images/ <host>:/mnt/ccimages

This file is served with "application/octet-stream" and browsers can't display it correctly. But this one has mime type set correctly to image/svg+xml.

FSTab is like this:

/mnt/ccimages fuse.geesefs _netdev,allow_other,--file-mode=0666,--dir-mode=0777,--iam,--uid=33,--gid=33,--use-content-type 0 0
vitalif commented 2 years ago

Hi. When this option is enabled mime type is guessed by extension using /etc/mime.types, so it shouldn't differ for different files. Does it reproduce for you every time with the "bad" file? I tried to upload it into my bucket and it got the correct mime type: https://storage.yandexcloud.net/vitalifpublictest/6113f3893b8cc_RNKB.svg

FractalizeR commented 2 years ago

Looks random currently. I will try to inspect object meta a little later and see if it helps. Will report here. From about 100 files, i have around 10 good ones, others are "bad". But their names doesn't look different. Extension is .svg everywhere

FractalizeR commented 2 years ago

Something looks to be wrong with the sync. I checked metadata of the files and some of them are ok:

image

but most are not:

image

They all were uploaded in a single go from GeeseFS using fsync. How can I help dig this down further? I tried to delete and recreate bucket - no success.

FractalizeR commented 2 years ago

PNG files have the same problem. Some have png content type, but most are left with octet-stream

vitalif commented 2 years ago

No idea... I tried to upload ~6500 gif/png/jpg files and all of them got correct MIME types. Also I don't see how https://pkg.go.dev/mime#TypeByExtension may give random results. By the way, what happens if you just remove --use-content-type? AFAIK in this case MIME type is guessed by the server.