Discourse Magic: turn 85kb to 40mb on the server



  • Step 1:
    Save this file to your computer( right click save as):
    file.gif

    Step 2: drag and drop it into a post.


    Right click save uploaded file
    uploaded-file.gif / ab27d38d57cf96c3.gif

    Discourse store file by hash of content, changing a byte each upload will finish the server storage fairly quickly.



  • Looks like Discourse is assuming files with image extensions are actually images and the optimizer is going bonkers.



  • looks like it, it detect that the file is svg by the content.

    I was able to replicate the issue with a smaller input 569 bytes that produced ~40mb file.
    it actually closed the </svg> tag in the output.

    <?xml version="1.0" encoding="utf-8"?>
    <!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948)  -->
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
    <svg version="1.1" baseProfile="basic" id="svg2" xmlns:svg="http://www.w3.org/2000/svg"
    	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="900px" height="900px"
    	 viewBox="0 0 900 900" xml:space="preserve">
    <path id="path482" fill="none" d="M184.013,144.428"/>
    


  • Is there by any chance, the concept of a loop in SVG?
    Or, more plausibly, it converts the SVG to a bitmap and then writes out the bitmap in SVG format?
    Your output file just seems to be a long list of circles (pixels?), although it has got a bit mangled at each end...



  • @tar said:

    Or, more plausibly, it converts the SVG to a bitmap and then writes out the bitmap in SVG format?

    something among that line sound reasonable.


  • Winner of the 2016 Presidential Election

    Some SVG editors will do a similar thing to the clipboard, as recently(ish) discovered. I can c/p stuff from Inkscape directly to Discourse or Imgur for example. WebKit will pick up both the image and SVG data (the whole XML blob) and paste both. Gecko will just pick up the rendered image. Imgur seems smart enough to ignore the XML bits.

    The thing is, since you get no options for sizing when copying stuff I buttume it will scale it according to canvas size when rendering the bitmap. Theoretically, if I set my canvas size to A0 and drew a single rectangle covering the whole page it will produce an absolutely huge PNG upon copying. The same thing might be happening serverside.

    I'll give this a go a bit later. And, preferably, after we figure out what the import / backup status is, I'd like not to fill up the disk on the server if it goes horribly right (wrong?)... :P


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.