D18384: Throw warning before creating directory named '~' escaped by '\'

Nathaniel Graham noreply at phabricator.kde.org
Sat Jan 19 15:00:27 GMT 2019


ngraham requested changes to this revision.
ngraham added a comment.
This revision now requires changes to proceed.


  Neat idea.

INLINE COMMENTS

> knewfilemenu.cpp:440
> +    } else if (name.operator==(QLatin1String("\\~"))) {
> +        confirmDialog->setWindowTitle(i18n("Create directory named ~?"));
> +        KMessageBox::createKMessageBox(confirmDialog, buttonBox, QMessageBox::Warning,

That's not accurate; the dir just //begins with// `~`.

> knewfilemenu.cpp:442
> +        KMessageBox::createKMessageBox(confirmDialog, buttonBox, QMessageBox::Warning,
> +                                   i18n("The name \"%1\" is unsafe to have, since sudo rm ~ may will remove the home directory instead.", name),
> +                                   QStringList(),

Hmm, that might be too technical an explanation. How about this instead?

`Beginning a file name with a tilde character ("~") is not recommended because it may be confusing or dangerous if files are deleted using the terminal.`

> knewfilemenu.cpp:907
>                  if (!writeHiddenDir) {
>                      confirmCreatingHiddenDir(name);
>                      return;

Now the name of this function is no longer accurate since you're using it to display a message for a name that wouldn't result in in the file or folder being hidden.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D18384

To: shubham, ngraham
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190119/52264d95/attachment.html>


More information about the Kde-frameworks-devel mailing list