Bug 108161 - Cannot use the save dialog to save file if the name contains a slash (unlike when using KNewFileMenu to create a new file)
Summary: Cannot use the save dialog to save file if the name contains a slash (unlike ...
Status: REOPENED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: Open/save dialogs (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2005-06-26 15:33 UTC by Gioele Barabucci
Modified: 2022-04-25 21:00 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gioele Barabucci 2005-06-26 15:33:11 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    Gentoo Packages

Using the standard file save dialog, you cannot save a page with a file name that contain a "/". However you can rename an existing file to a name that contains "/".

For example:
* open a web page
* select "save as"
* use "2005/10.html" as file name
-> you will be told that you cannot save it
* save it as "2005.html"
* go with konqueror to the dir that contains "2005.html"
* rename it to "2005/10.html"
-> everything works fine
Comment 1 Thiago Macieira 2005-06-26 19:06:49 UTC
Right, '/' is not a valid character in filenames.

But Konqueror allows you to have them, because it replaces '/' with "%2f". I don't agree with that, but it's done.

Reassigning to kio/kfile for evaluation.
Comment 2 Carsten Lohrke 2005-06-28 02:31:02 UTC
There's is a similar bug report regarding k3b and nautilus ( Bug 107574 ). I'd prefer to disallow it, too, but more important would be a multi-desktop-wide agreement how to deal with a slash in a folder.
Comment 3 Rickard Närström 2006-03-02 08:40:48 UTC
When saving:
'/' -> "%2f"
'%' -> "%%"

When reading:
"%2f" -> '/'
"%%" -> '%'
'%' -> '%'

To escape characters in filenames can be a good thing couse of the limitations of the underlaying filesystem (Ok, in this case it the limitation of the syscall interface), in UNIX there are only two characters that are invalid: '/' (HEX: 2F) and '\0' (HEX: 00).

But if you have a Windows port of KDE or try to write to a vfat partiton there are a lot of invalid characters. we need to escape those too, a incomplete escape system is no good.

To escape filenames shuld be configurabel, add a "escape illegal characters in filenames" option, it can even be a good thing to escope characters on some pretecolls or from some host but not on other.

The '%' character is NOT invalid and shuld NOT be escaped - but if we acctivate escape we need to take one choracter to mark escoped characters, '%' is a good for this. But escape it as "%25" (This will give us a natural way of escaping characters that are invalid in other filesystem or OSes like ':' -> "%3a", '?' -> "%3f" etc.)
Comment 4 Carsten Lohrke 2006-05-31 20:55:32 UTC
>But if you have a Windows port of KDE or try to write to a vfat partiton there are a lot of invalid characters. we need to escape those too, a incomplete escape system is no good. 

Not an option for unixoid systems. I won't be the only one who would be quite pissed, if my files would be scrambled, just to adhere to the blue screen world.
Comment 5 Christoph Feck 2009-08-27 02:36:35 UTC
Moving from "kio/kfile" component to "kfile" product, helps sorting out duplicates.
Comment 6 Sergey Kondakov 2010-12-04 16:02:36 UTC
slashes interpreted as divisor of directory name and filename instead of being part of filename in KDE 4.5.3.
moreover, with KDE 4.x "%2f" is not shown as slash at all and trying to add slash character into filename is treated as attempt to move it or something like that.

which makes it impossible to have slash character in filenames under KDE 4.x at all and is a loss of functionality, regression.
Comment 7 Ahmad Samir 2021-07-24 16:25:33 UTC
There is nothing we can do about filenames on Linux not being able to have slashes, as has been said, a / is the path separator.
Comment 8 Sergey Kondakov 2021-07-24 21:20:02 UTC
(In reply to Ahmad Samir from comment #7)
> There is nothing we can do about filenames on Linux not being able to have
> slashes, as has been said, a / is the path separator.

Have you decided just not to read the whole 16-year old thread that describes exactly what you can do and how it was done in KDE 3 previously, before being broken ?

But in KDE 5 all regressions and bugs are just renamed to features, that is clear from all the "development", convenience of a user be damned.
Comment 9 Nate Graham 2021-07-26 14:44:37 UTC
Yeah, I think there has to be a way to make this work at least in the UI. What macOS does is allow the user to use the slash character in filenames (through the GUI of course) but silently represents them as a colon character in the actual POSIX filename. We could maybe do something similar. It's kind of lying to the user about the underlying representation, but the user generally doesn't care about the underlying representation. :)
Comment 10 Sergey Kondakov 2021-07-26 22:38:51 UTC
(In reply to Nate Graham from comment #9)
> Yeah, I think there has to be a way to make this work at least in the UI.
> What macOS does is allow the user to use the slash character in filenames
> (through the GUI of course) but silently represents them as a colon
> character in the actual POSIX filename. We could maybe do something similar.
> It's kind of lying to the user about the underlying representation, but the
> user generally doesn't care about the underlying representation. :)

Fraction/division slash may work - ⁄ (U+2044) and ∕ (U+2215). But colon wouldn't as it's a normal and often-used character in Linux. These slashes stay too close to letters unlike a normal slash.
Which is why, I assume, KDE3 used web-like "escape" encoding. But escape encoding is ugly.
Comment 11 Jack Hill 2022-04-25 21:00:00 UTC
Is there any standard behaviour that should happen when saving a file with a slash in the name? I ask because Kate fails and complains about a lack of permissions, while Firefox simply creates the directory. Maybe there should be a warning when trying to save a file with a slash saying that the result is application-dependent?