Changeset 4019


Ignore:
Timestamp:
Nov 29, 2007, 2:53:52 PM (15 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #852: Check if a file/directory already exists when moving a file/directory to another

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/filemanager/files/index.jsp

    r3719 r4019  
    426426      {
    427427        File f = File.getById(dc, id);
     428        if (File.exists(dc, newDirectory, f.getName()))
     429        {
     430          throw new ItemAlreadyExistsException("Directory '" + newDirectory.getName() + "' already contains file: " + f.getName());
     431        }
    428432        f.setDirectory(newDirectory);
    429433        numMoved++;
     
    438442      {
    439443        Directory d = Directory.getById(dc, id);
     444        if (Directory.exists(dc, newDirectory, d.getName()))
     445        {
     446          throw new ItemAlreadyExistsException("Directory '" + newDirectory.getName() + "' already contains subdirectoy: " + d.getName());
     447        }
    440448        d.setParent(newDirectory);
    441449        numMoved++;
Note: See TracChangeset for help on using the changeset viewer.