LDraw.org Discussion Forums
view diff is broken? - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: General (https://forums.ldraw.org/forum-12.html)
+--- Forum: Help (https://forums.ldraw.org/forum-13.html)
+--- Thread: view diff is broken? (/thread-6754.html)

Pages: 1 2


view diff is broken? - Matthew W. Noel - 2012-11-12

On the parts tracker whenever I click on "view diff" my browser (Google Chrome) downloads a file called "ptdatdiff.cgi" which i can't open. I know chrome is compatible with .CGIs because it had to use ptdetail.cgi to get to the "view diff" link. Anybody know why this might be happening?


Re: view diff is broken? - Steffen - 2012-11-12

Firefox has the same problem.
The contents of the downloaded file is a concatenation
of the two files to be compared.

Here's a link to the function:
http://www.ldraw.org/library/tracker/tools/
Click on "DAT Diff".


Re: view diff is broken? - Matthew W. Noel - 2012-11-13

still does the same thing. whenever I click go it downloads ptdatdiff.cgi.


Re: view diff is broken? - Chris Dee - 2012-11-13

Do you have a default program a assigned to .cgi files? I don't and when I download I'm prompted for the program to use and can choose, for example, LDView. It should be fixable, but I'm unlikely to have time to look at it this week.


Re: view diff is broken? - Michael Heidemann - 2012-11-13

Yes, that is correct.
Please download that file (ptdatdiff.cgi) and open it with LDView.
The content of the file **is** the comparison!

LDView will not open directly, like PDF files with Acrobat Reader will do!


Re: view diff is broken? - Michael Heidemann - 2012-11-13

I have found the following on this (http://www.tek-tips.com/viewthread.cfm?qid=1175419) page:

Code:
CGI programs can return a myriad of document types.
They can send back an image to the client, and HTML document, a plaintext document, or perhaps even an audio clip.
They can also return references to other documents.
The client must know what kind of document you're sending it so it can present it accordingly.
In order for the client to know this, your CGI program must tell the server what type of document it is returning

Maybe this helps us to improve that tool.


Re: view diff is broken? - Matthew W. Noel - 2012-11-14

that makes more sense now, though perhaps that should be made more apparent on the parts tracker.


Re: view diff is broken? - Steffen - 2012-11-14

Chris, I think the solution is very simple.
You just need to make sure that the HTTP header sent in the response from the server states the proper MIME type for LDRAW files. The element you need to send back to the client is
the "Content-Type" field in the HTTP response header.
The user can then associate a tool with that MIME type.
As "LDRAW" is of course not part of the official MIME standard, we need to use the "x-" prefix for unofficial file types.
Probably
application/x-ldraw
or
model/x-ldraw
would be something good IMHO.
Alternatively, you could make the URL "appear" as an *.ldr file (instead of *.cgi), so users might,
alternatively to the MIME type, use their normal file associations for opening the result file.
Since the result - as far as I can see - is a mix of both the old and the new version of the file,
probably either *.mpd or *.ldr would be a good file extension to pick; not *.dat


Re: view diff is broken? - Chris Dee - 2012-11-14

Yes, aware of that. An unofficial MIME type of application/x-multi-part-ldraw has been defined in the past for MPD files.


Re: view diff is broken? - Chris Dee - 2012-11-14

I just checked and ptdatdiff.cgi does set the response header content type to application/x-ldraw. At least that's what the code does and that's what Firebug sees.