Hashes from uploading images to Discourse (Was: The One Where @loopback0 Tests Images)
-
Test:
-
<img src="/uploads/default/15926/32c52c6c7e11d89f.png" width="256" height="260" title="seal">
Test:
<img src="/uploads/default/17871/0a1a4d973e5223a4.png" width="256" height="260">They don't look the same to me.
-
Test 2:
-
Test 2:
<img src="/uploads/default/17872/e05254a30f2f0414.png" width="256" height="260">Not empty
-
Oh look, quote notifications actually lead to Jeffed posts. STUFF WORKING!
-
STUFF WORKING!
Sorta.
If you have a topic open when posts get Jeffed in, they don't show up in the post stream until it's reloaded.
-
Oh look, quote notifications actually lead to Jeffed posts. STUFF WORKING!
Are you sure? Maybe you're mistaking this for another site.
-
The One Where @loopback0 Tests Images
I never saw that episode of Friends…
-
Or out of the topic you're reading. It actually killed my stream and I thought my post I was writing at the time got eaten. Had to hard refresh.
-
So, on topic... this doesnt' seem to be md5...
$ md5sum e05254a30f2f0414.png ec81f59dc9da70890331f6c3c837ba06 e05254a30f2f0414.png
Too short... fuck knows what it is then.
-
-
-
My system utilities disagree:
$ crc32 e05254a30f2f0414.png b5e960c7
8 hex digits, 32bits, looks legit. Then again, I never really used CRC32 for anything myself, I understand the principle but I'm by no means an expert.
-
@loopback0 have you tried putting multiple images in one post?
-
Huh… miscounted.
Also, can't be arsed trawling through the Discosource to find the function used.
-
@loopback0 have you tried putting multiple images in one post?
You mean the same image multiple times? That, expectedly, reuses the image.
<img src="/uploads/default/17872/e05254a30f2f0414.png" width="256" height="260">
<img src="/uploads/default/17872/e05254a30f2f0414.png" width="256" height="260">
<img src="/uploads/default/17872/e05254a30f2f0414.png" width="256" height="260">
-
Hey, that hash actually matches one of the earlier ones!
-
Oh yeah.
Discoursistent.
-
Maybe it does try and do that but Server Cooties™ upset it. Maybe it's just a Discoursistent POS.
-
Hmm.
-
So why does it get different hashes for the same file?
-
And SHA1 is longer that the filename if I'm not mistaken. Wait... The hell is
hexdigest
?As in, does it truncate it in some way?
-
So why does it get different hashes for the same file?
Maybe the image is getting changed on upload some how?
Actually, no, because I copied it from the same image on the times it got the different hashes.
-
Still confused by length:
$ sha1sum e05254a30f2f0414.png 511c15e25867e16d45f15c44ce0350e7cd7d8f3c e05254a30f2f0414.png
-
Copy it back in, see if it still gets the same hash.
<img src="/uploads/default/17877/1edfc648645ae045.png" width="256" height="260">
-
Well, copy/paste in browser only gets a new one.
Dragging from desktop... wait... Same as your last one but not
e05254a30f2f0414
which was what I downloaded...Upload matches drag&drop
I give up.
-
Every time it's saved and dragged back in - new hash!
Seems the image changes somehow each time it gets copied/saved. No idea.
PS > get-filehash .\1edfc648645ae045.png -algorithm MD5 Algorithm Hash --------- ---- MD5 13A9EC2DC4A5E0F3818DFE3F42A41CB8
PS > get-filehash .\e05254a30f2f0414.png -algorithm MD5 Algorithm Hash --------- ---- MD5 EC81F59DC9DA70890331F6C3C837BA06
-
Testing a hunch in Firefox... AHA!
I think I got it! @loopback0, are you using a WebKit based browser?
-
-
I think I got what's happening. See:
http://what.thedailywtf.com/t/svg-upload-test/7869
WebKit seems to pick evertyhing up from clipboard, not just the image data. Copy image / paste in FF produces the same hash. WebKit seems to pick up the URL from clipboard / path from local drive as well. I'm buttuming that Discourse is not cleaning that extra data up and calculates it into the hash. And since each time you download the image the filename changes...
-
That makes sense I guess.
-
Yeah, it's convoluted but seems consistent across WebKit / Gecko divide.
I don't 100% understand why it does that for uploads too, but given that it gives a you percentage while uploading it's either Flash or HTML5 upload functionality. Which is implemented browser-side in that case.
-
Before this closes: I think this is a legitimate thing to report. It's either a Discourse or Ruby / some JS library bug. I use the same method including the HTML5 upload in my project with PHP backend and I have no such problems: hashes are consistent regardless of the browser.
I'll check that tomorrow just in case because I don't want this kind of shit happening in my application, but I'm 99.9% sure I didn't experience this.
-
This topic was automatically closed after 70 minutes. New replies are no longer allowed.
-
-
Reopened.
-
They dress in bunny suits and bitch about Microsoft buying Intel.
-
-
Why would they take a sha1 of the file's contents and then not use it to make the hash of the upload?
-
Why would they strip all the formatting from text when it's selected for quoting?
-
Why would they strip all the formatting from text when it's selected for quoting?
Ooh! I saw this one on meta.d! The answer was ... "Getting the formatting is hard." Yeah. That was what they said.
-
Is this some test to see who sees a ladie in there and who sees a seal?
-
"Getting the formatting is hard." Yeah. That was what they said.
Harder than nesting more than one
[code]
block inside a[quote]
block?
Oh, um, wait...
-
But all you have to do is do nothing...
-
But all you have to do is do nothing...
Remember, we are talking about discodevs. They only meet a certain standard.