Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Browser(s) seem to unpack .osexp archive resulting in a Failed to open file error

Hi all,

Guess this isn't a problem in OpenSesame but is does effect .osexp files so I thought I post it here.

When downloading an .osexp file that has something in the file pool so it's an .tar.gz archive and not a plain-text file (more info), some browsers seem to unpack the .tar.gz archive. This can result in the following error when opening the .osexp file in OpenSesame:

Failed to open file

item-stack: 
exception message: 'utf8' codec can't decode byte 0xd2 in position 3526: invalid continuation byte
time: Wed Sep 28 12:36:36 2016
exception type: UnicodeDecodeError

For example the experiment at the URL below gets unpacked when downloading with Firefox (v49.0.1 on Win7x64):

When opening both the download and the original experiment you can clearly see the difference (some 'in between' .osexp file) with 7-zip:

One can also clearly see the difference by using a plain-text editor like Notepad++


Internet Explorer (v11 on Win7x64) doesn't do this (for the URL provided above) but you will have to Save as or rename from Archive.tar to Archive.osexp.

Hope this is of some help to someone :)

Best,
Jarik

Comments

  • Opera does this too. The result is so weird.
    You get some .gz data which you shall unpack. The result is an empty .osexp file.

  • Hi Jarik,

    Thanks for the clear explanation! It puzzled me for a minute, but here's what I think is going on:

    • The original .osexp file is really a .tar.gz file, meaning it has been compressed twice: first to a .tar and then again to a .gz. This is a traditional Unix compression technique.
    • Once downloaded, the .osexp file has become a .tar file, meaning that the browser has extracted the first .gz compression layer.
    • You can tell this also by the fact that the original file is much smaller (3.5kB in your case) than the downloaded file (30.7kB).

    So the browser automatically unpacks the file after download, corrupting it in the process. Why?

    Well, .gz is also used to reduce bandwidth when downloading large files, in which case the automatic extraction is necessary (because you don't want to download a regular file and end up with a .gz archive). To see whether the .gz compression is only for bandwidth reduction, or really a part of the file, the browser looks at the header that is sent by the webserver. And when the webserver sends the wrong header, the downloaded .gz file is wrongly extracted. So the problem seems to be with the webserver, and not with the browser nor OpenSesame. But it may affect a lot of webservers, so it's still a problem.

    I'll think about the best way to deal with this. The easiest solution may be to simply allow .tar archives in OpenSesame as well.

    Cheers!
    Sebastiaan

  • Not that it solves the issue, but to be on the save side, I usually wrap my .osexp files in .zip files before sending them around via email.

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.