How should we handle a forward slash "/" in new file and rename dialogs?

Mark markg85 at gmail.com
Fri Nov 2 23:45:14 GMT 2012


On Sat, Nov 3, 2012 at 12:40 AM, David Faure <faure at kde.org> wrote:
> On Friday 02 November 2012 22:15:18 Mark wrote:
>> On Fri, Nov 2, 2012 at 10:08 PM, Mark <markg85 at gmail.com> wrote:
>> > On Tue, Oct 30, 2012 at 10:39 PM, Frank Reininghaus
>> >
>> > <frank78ac at googlemail.com> wrote:
>> >> Hi Mark and Emmanuel,
>> >>
>> >> thanks for your investigations!
>> >>
>> >> 2012/10/30 Mark:
>> >> > Hi,
>> >> >
>> >> > I'm doing a bit of dolphin bug triaging and encountered a few bugs
>> >> > already that have something to do with a "/" in a filename. See [1]
>> >> > and [2]. I can see a few possible solutions here.
>> >> >
>> >> > 1. "/" is forbidden.
>> >> > --------------------------------------
>> >> > Since "/" is a directory seperator it might just be unwise to even
>> >> > consider using it in a filename. Also, if dolphin supports this it's
>> >> > by far a certainty that others support it as well.
>> >> >
>> >> > 2. Replace "/" by "⁄".
>> >> > --------------------------------------
>> >> > It looks like a slash but is a divider sign. This might be a workable
>> >> > solution but will change the user input (a "/") to the divider symbol.
>> >>
>> >> it seems that this currently happens when renaming with the rename
>> >> dialog, even though I can't see why this could make sense. Before we
>> >> discuss this further, could someone investigate where in the code the
>> >> replacement happens and why it's done?
>> >>
>> >> Best regards,
>> >> Frank
>> >
>> > I've done a few hours (!!) of digging just to find where the / is
>> > replaced by a ⁄ and couldn't find it within the dolphin sources.
>> > Actually, the new file stuff all seems to be going through
>> > DolphinNewFileMenu which goos back to a KNewFileMenu which can be
>> > found here:
>> > http://api.kde.org/4.9-api/kdelibs-apidocs/kfile/html/knewfilemenu_8cpp_s
>> > ource.html From there on i'm losing it's path since i'm trying to follow
>> > the
>> > KInputDialog, but that class in only included in that file, not
>> > actually used.
>> >
>> > Adding David to the CC since he might know more here? (he is in the
>> > author list of that file). David, what i'm trying to figure out is why
>> > a "/" is replaced by a "⁄" (notice the subtle difference) when it's
>> > used inside a filename. A "\" doesn't get replaced and just works as
>> > expected.
>>
>> GOTCHA!
>> http://api.kde.org/4.9-api/kdelibs-apidocs/kio/html/global_8cpp_source.html
>> line 149 is the one that translates "/" to "⁄".
>>
>> Now the question is: Why?
>
> So that it can be used in a filename.
>
> E.g. you can create a file named http:⁄⁄www.kde.org.desktop
> containing a link to that URL.
>
> KDE - no limitations in file names, even '/' is allowed.
>
> --
> David Faure, faure at kde.org, http://www.davidfaure.fr
> Working on KDE, in particular KDE Frameworks 5
>

Ehh, i understand the reasoning since the full path is used for all
kio operations and that will probably cause issues if an actual "/" is
used within a filename. However, i do think it's wrong to replace a
"/" with "⁄". I think the actual forward slash should be either
allowed or forbidden, not renamed.




More information about the kfm-devel mailing list