Review Request: Disallow names of files containing '/' or being equal to "." or "..".

Matthias Fuchs mat69 at gmx.net
Mon May 30 00:35:32 BST 2011



> On May 28, 2011, 9:29 a.m., David Faure wrote:
> > The handling of '/' could use KIO::encodeFileName instead, for consistency. I agree about "." and ".." though ;)
> 
> Mark Gaiser wrote:
>     I wonder.. don't we need a "isFilename" function that checks if a filename meets all the characters that are allowed in a filename thus returning false when it starts with a / or for example contains a *? or being equal to . or .. ? That would make the use more "portable" since i can imagine other apps benefiting from that (any app that needs to create a file or folder from user input)
> 
> Richard J. Moore wrote:
>     Filenames containing * and ? are perfectly legal. The only truly illegal characters in a unix filename are / and \0. To be portable, you need to consider the underlying filesystem in which a file is being created since this sets the rules, for example FAT has a bunch of characters that can't be used (eg. consider how a filename starting with ? would interact with its file deletion handling). Short version, I don't see how the function you propose could be implemented.
>
> 
> Mark Gaiser wrote:
>     You are completely right. I didn't think about the differences per filesystem.

Well if a function like that was to be done it would need at least two parameters.
1. tried file name
2. (target)location of the file

Then you could easily find the mount point and the file system via:
KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(fileUrl.directory());
const QString mountType = mountPoint->mountType();

Now what I fear is that this could be a costly operation to do that for many files, e.g. when you do a copy operation.
And the result could only be cached for the same directory, yet not for similar ones as you could mount a different file system in a sub directory.


- Matthias


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/101456/#review3562
-----------------------------------------------------------


On May 28, 2011, 6:26 p.m., Matthias Fuchs wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/101456/
> -----------------------------------------------------------
> 
> (Updated May 28, 2011, 6:26 p.m.)
> 
> 
> Review request for kdelibs and David Faure.
> 
> 
> Summary
> -------
> 
> nt
> 
> 
> This addresses bug 211751.
>     http://bugs.kde.org/show_bug.cgi?id=211751
> 
> 
> Diffs
> -----
> 
>   kio/kio/kdirmodel.cpp 6bf57be 
>   kio/kio/kfileitemdelegate.cpp cb3939d 
> 
> Diff: http://git.reviewboard.kde.org/r/101456/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Matthias
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110529/d12a0269/attachment.htm>


More information about the kde-core-devel mailing list