Menu

#74 WW sometimes puts binary file contents in the output page

workingwiki
closed
5
2014-06-11
2011-03-10
Lee Worden
No

It wants you to register the file extensions you'll use and use them correctly. It could do mime type detection (but I'm worried this would produce annoying false positives and negatives). It could at least check things for binary content just before it displays them as source.

Related

Bugs: #544

Discussion

  • Lee Worden

    Lee Worden - 2013-07-24

    The Unix file and diff utilities check for binary content by reading the first 1000 bytes and seeing if they include any '\0' characters. WW could definitely do that.

     
  • Lee Worden

    Lee Worden - 2014-06-10

    I think this only need to prevent displaying binary stuff as source, so I can do a binary-content check at the last minute before source display, in display_file_contents. At that point, it's already got the file contents loaded into a variable, so it should be straightforward to check the first 1000 bytes. I wonder, though, if I should check it for unicode-ness, rather than looking for '\0', since anything that's not unicode is likely to be a problem.

     
  • Lee Worden

    Lee Worden - 2014-06-10

    Done, seems to work okay.

    The side effect of this is that binary file types such as mp4, etc. no longer need to be listed in $wwLinkExtensions - this might have side effects such as causing it to try to upload such files to text wiki pages. I want to check on that before closing this ticket.

     
  • Lee Worden

    Lee Worden - 2014-06-11

    Well, maybe we do want to keep them in $wwLinkExtensions though, because if not, when a file's oversize (as video files often are), it doesn't load them into memory and so doesn't do the unicode check. Instead you get the "file is too large to display" message. It's avoided by using display=link or listing the file's extension in $wwLinkExtensions.

     
  • Lee Worden

    Lee Worden - 2014-06-11
    • status: open --> closed
     
  • Lee Worden

    Lee Worden - 2014-06-11

    Given that, I don't feel too urgent about the uploading of binary files issue. I've opened [#548] for that.

     

    Related

    Bugs: #548

Anonymous
Anonymous

Add attachments
Cancel