It's relatively easy to create 2 different files with the same md5
hash value:
http://www.win.tue.nl/hashclash/SoftIntCodeSign/
Of course I very much like the idea of not wasting storage on
identical files...
It was important to me to keep the keys very clean for several
reasons, but I see now that S3 doesn't support true renaming of
directories (anything before a / in the key name) or files. Instead
it simply copies the files individually with a new name. It'll be
very common for me to need to rename many of these virtual directories
with thousands of files in them... so I'm going to just use names
ensured to be unique with my database.. Amazon hasn't given any
indication in their forums that they plan to allow true renaming of
object keys in the future either.
On Jul 26, 1:30 am, James Murty <
jamu...@gmail.com> wrote:
> You cannot really accomplish what you want with this approach using S3, or
> indeed with any distributed file system like S3.
>
> Due to the distributed nature of S3 you cannot assume that a result you get
> from the service is 100% accurate. Because the service exists over many
> different servers it may take some time for changes to be synchronized to
> all of them. In other words, there could be a delay between uploading a file
> and being able to test its presence within S3. If you rely on looking up
> file names on S3, there is a good chance that you will overwrite a file
> sooner or later.
>
> You should consider use a different mechanism to ensure files are not
> overwritten. For example, you could include the hash of a file's contents in
> the S3 object name to ensure that every unique file has a unique name. You
> can still retain the original filename if you set the name in the
> Content-Distribution header and make the hash value a prefix of the S3
> object name, like so:
>
> <md5-hash-value>/original-filename.jpg
>
> This wouldn't produce two different objects if a user uploads the same file
> twice, but if a user does that I don't see why you can't keep just one copy
> anyway.
>
> Hope this helps,
> James
>
> ---
http://www.jamesmurty.com