Jump to content

Chunked uploads with long filenames not truncated


Makoto

Recommended Posts

First, please excuse me reporting bugs here, my client area account is currently bugged and I can't submit support tickets do to my e-mail being changed and some kind of issue with the support desk software.

In short, this is an issue specific only when uploads are being chunked. Non-chunked uploads do not produce the error.

Say you have a video file with a really long filename like this,
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).mp4

If you try and upload it as a file submission without needing to chunk it, it will upload file, and you'll get a filename like this returned,
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).mp4.2ca3c24a17116f9fe2ebe688bf7cb0ee.mp4

Which is 201 characters and has no problem being saved on Windows or Unix systems.

Now, here's what IPS tries to rename that file to when the upload is chunked,
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))).mp4.2a847996b9a6ec8384c1b621e41e0038.mp4

This is 265 characters in length and produces an error on Windows systems,

msedge_oNyzxu8DRS.png.16954a63f4b6bb435acceddc85d7927b.png

But simply fails silently on Unix (and the file returns 404'd).

Looks like you're skipping the setFilename call when processing chunked uploads and just trying to rename the file directly, which skips this necessary check in the aforementioned method,

		/* Most operating systems allow a max filename length of 255 bytes, so we should make sure we don't go over that */
		if( \strlen( $filename ) > 200 )
		{
			/* If the filename is over 200 chars, grab the first 100 and the last 100 and concatenate with a dash - this should help ensure we retain the most useful info */
			$filename = mb_substr( $filename, 0, 100 ) . '-' . mb_substr( $filename, -100 );
		}

		$this->filename = $filename;

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...