JackYeh / s3fs

Automatically exported from code.google.com/p/s3fs
GNU General Public License v2.0
0 stars 0 forks source link

mv (rename) does not update the Content-Type metadate if the file extension changes #101

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. touch file.txt
2. mv file.txt file.html

What is the expected output? What do you see instead?

Upon creation of file.txt, the metadata field Content-Type receives a value of 
text/plain   It is expected that upon the rename that the Content-Type get 
updated to text/html in this case. It does not and remains
text/plain.

This issue was discussed in the wiki:

 Comment by project member rrizun,  Feb 14, 2009

ah, I know what the problem is: s3fs does not consult mime.types on renames... 
when rsync copies, it copies to a tmp file and then renames it at the end, thus 
the loss of s3fs content-type... to fix it, just add these lines to s3f3_rename

meta["Content-Type"] = lookupMimeType(to); meta["x-amz-metadata-directive"] = 
"REPLACE";

(Note- NOT tested!)

Original issue reported on code.google.com by dmoore4...@gmail.com on 20 Oct 2010 at 2:39

GoogleCodeExporter commented 8 years ago
Modified and tested the proposed fix.  Content-Type is updated as expected upon 
renaming a file.

Original comment by dmoore4...@gmail.com on 20 Oct 2010 at 2:56