Wrong file extension after re-upload of duplicate file


(Thomas) #1

Hello,

Thank you very much for all the work done on Discourse.

I’m running it and I’m facing an unexpexted issue. I did not find any similar topic around the Web with my favorite search engine :wink:

When I try to upload a FreeCAD file *.FCStd Discource “recognize” it as a *.pdf.

As an example if I upload a file called file.FCStd after the file will be uploaded the link in the post will link to a gibberish name like /uploads/default/original/1X/bcd765d5807215c5eb3692412248f6abbf278ab2.pdf. The annoying part is the extension of the file :disappointed:

I have no clue on how to solve this.

Thank you for your help.


(Gerhard Schlager) #2

I can only think of three reasons that could be causing this:

  1. Someone renamed the FreeCAD file as a PDF and uploaded it before you uploaded the FreeCAD file.
  2. There’s a hash collision between an uploaded PDF and your FreeCAD file (rather unlikely, but not impossible).
  3. There’s a bug that nobody noticed until now.

Can you please verify a few things?

  • Download the bcd765d5807215c5eb3692412248f6abbf278ab2.pdf and try to open it. Is it really a PDF file?
  • If it is not a PDF file, change the file extension to .FCStd an try opening it again. Does it work? Is it your FreeCAD file?

(Thomas) #3

No, it’s not a PDF. Acrobat Reader is not able to open it.

Yes, renaming the file after the download works. I’m able to open it in FreeCAD and that my file.

Do I have to fill out a bug report for this ?


(Régis Hanol) #4

I temporarily enabled .FCStd on try and successfully uploaded a FreeCAD file. The extension wasn’t changed. Something must be different with the file you’re trying to upload. Could you send me a link to the file you tried uploading so that I can test it with that specific file?


(Thomas) #5

You can download the .FCStd as a PDF on our Discourse instance :

You just have to change the extension from PDF to FCStd.

[EDIT]I just tried myself with an other FreeCAD file and it works. Maybe the issue is related to the fact that the same file name was upload previously as a .zip ?


(Sam Saffron) #6

Very likely a side effect / bug with our deduping logic.


(Thomas) #7

Thank you for all you quick and usefull answers. For me the question is answered.

If you would like to go deeper in this issue I write below the full story of how this append :

An user wanted to upload a FreeCAD file but the file extension was not in the authorized list. So he decided to zip his file to be able to upload it. This work correctly.

I later added the FreeCAD file extension in the file extension authorized list. The user decided to edit his post to replace the zip with the original FreeCAD file. This is at this point that we had a PDFextension to the file instead of the FCStd.


(Régis Hanol) #8

I checked and the “FCStd” is actually a zip file with a different extension. But I don’t think it’s related.

Here’s what I think happened:

  • They tried uploading a FreeCAD file with the .FCStd extension but couldn’t since it was not yet allowed
  • They changed the extension to .pdf and successfully uploaded the file.
  • You added the .FCStd extension to the list of authorized extensions
  • They tried uploading the original file again, but since we match files based on the MD5 hash of their content, we didn’t take it into account and returned the original .pdf file.