Why does TC URLencode local file paths?

Support for Android version of Total Commander

Moderators: sheep, Hacker, Stefan2, white

Post Reply
Tippfehler
Junior Member
Junior Member
Posts: 19
Joined: 2019-10-25, 15:16 UTC

Why does TC URLencode local file paths?

Post by *Tippfehler » 2019-11-05, 00:04 UTC

If I select Share or "Open with" for one or more files and send them to Image Shrink (a batch resizer app), the resulting file names are urlencoded - meaning, every space is replaced by %20, & by %26 and so on.

Example:

Code: Select all

AES vs EMR - Active (pressure-sensitive) Display Technologies (2018) - slrloungecom.jpg
Result:

Code: Select all

AES%20vs%20EMR%20-%20Active%20(pressure-sensitive)%20Display%20Technologies%20(2018)%20-%20slrloungecom.jpg
URL encoding/URIencoding is generally done on the webs to deal with "untrusted" links (and mask spaces and special characters).

But why with local files on Android? :?

Maybe, to protect badly written apps that can't properly deal with extended charsets (Unicode) from crashing (or worse)? -- as some kind of general security measure? After all, TC is running as root (a lot).

Or for the benefit of a plugin? Please explain.

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 38451
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Why does TC URLencode local file paths?

Post by *ghisler(Author) » 2019-11-05, 11:26 UTC

Yes, this is necessary - the paths passed to other apps are urls in the form file:// or content:// and must not contain spaces. It's the duty of the receiving app to urldecode these names.
Author of Total Commander
http://www.ghisler.com

Tippfehler
Junior Member
Junior Member
Posts: 19
Joined: 2019-10-25, 15:16 UTC

Re: Why does TC URLencode local file paths?

Post by *Tippfehler » 2019-11-06, 21:41 UTC

I've emailed the developer of Image Shrink and asked them to add URIdecoding capability, let's see what (if anything) s/he replies.

Thanks for explaining. However, gallery apps don't appear to do this, generally, while file managers do - X-plore too. Apples & oranges?

Image Shrink has a unique defense mechanism - whatever you throw at it, it can throw right back! So, with an image shared from X-plore or Total Commander (Send to), and shared back for saving, guess what... the results are URIencoded! :mrgreen: The complex sharing mechanisms involved also seem to get a bit confused, because I end up with two or three (resized) copies of the shared image(s).

There are gazillions of photo resizing apps, but somehow Image Shrink (Google Play) is the only one I've come across so far that can deal with fairly LARGE images, reliably. I have a 1600x2500 screen, *only* 2,7 GB RAM, and a web browser that can take full-page screenshots. Somehow, this is a recipe for disaster for most apps... or at least for badly resized (or cropped), "pixellated" pictures.

Post Reply