Inexact error during file or directory rename #13256

Open
sartatpdev999 opened this Issue Jan 18, 2017 · 0 comments

Projects

None yet

2 participants

@sartatpdev999
Contributor
sartatpdev999 commented Jan 18, 2017 edited

Summary

When i trying to rename directory (by right-clicking in File Manager) to existing directory name i get inexact error. For example, i have two directories in /path/to/dir:

  • test

  • _test

And when i trying to rename _test to test i get the following error:

An unknown error occurred while trying to rename the directory.

I think it would be better something like this:

A directory already exists with that name in that location.

This feature also applies to files.

Step to reproduce

Checking for file or directory existence while renaming. Something like:

  if (file_exists($newPath)) {
    $this->addError('name',$this->xpdo->lexicon('file_folder_err_ae'));
    return false;
  }

For file existence:

$this->addError('name',$this->xpdo->lexicon('file_err_ae'));

In:

  • core/model/modx/sources/modfilemediasource.class.php

  • and all other related files

Expected behavior

When trying to rename directory to existing name it should throw:

A directory already exists with that name in that location

When trying to rename file to existing name it should throw:

File %s already exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment