coolaj86 / formaline

formaline is a module for handling form requests ( HTTP POSTs / PUTs ) and for fast parsing of file uploads.
Apache License 2.0
239 stars 16 forks source link

clarify meaning of `sha1name` #2

Closed coolaj86 closed 13 years ago

coolaj86 commented 13 years ago

I'm confused as to what sha1name means.

It isn't the sha1sum of the file, correct?

Is it the sha1sum of t he name of the file?

That doesn't seem very safe. If I upload a file called me.jpeg and someone else uploads a file called me.jpeg, what would prevent collision?

Or let's say I have a backup service and a client is uploading two files of the same name in one request? Will the sha1sums be different?

I would prefer a UUID or a sha1sum which includes some random element.

Or is each sha1name unique and I'm misunderstanding the documentation?

rootslab commented 13 years ago

Hi coolaj86, sha1name is the filename SHA1 hash !

two different user never causes a filename collisions! The directories are different!

If you upload, for example, two files with the same name, through the same POST, the second file are renamed wth a different sha1name (with a random seed).

If you upload a file with DIfferent POSTs:

I have written about it in the 'File Uploads' section in the Readme!

rootslab commented 13 years ago

ops, yes sha1name is unique!

rootslab commented 13 years ago

I have added comments to Readme for sha1name . ;)

lonevan commented 12 years ago

'I would prefer a UUID or a sha1sum which includes some random element.'

Agreed..

'getSessionID' function cannot fit for all siturations. For example, some users upload files much more than others, so I don't want to create an unique ID Directory but some random dirs.

But the filename is created by SHA1 hash. When then upload files with the same name, collisions occurs..

lonevan commented 12 years ago

To give user a chance to use UUID or random string as filename, maybe formaline could add a config method?