Skip to content

Commit 0a1d237

Browse files
authored
Merge pull request #1044 from 7ammer/master
Fix where renaming a file fails when alphanumeric directory is true
2 parents ac97c73 + 5ed9160 commit 0a1d237

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Controllers/RenameController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ public function getRename()
3535
}
3636
}
3737

38-
if (config('lfm.alphanumeric_directory') && preg_match('/[^\w-]/i', $new_name)) {
38+
if ($is_directory && config('lfm.alphanumeric_directory') && preg_match('/[^\w-]/i', $new_name)) {
3939
return parent::error('folder-alnum');
40-
// return parent::error('file-alnum');
40+
}
41+
else if (config('lfm.alphanumeric_filename') && preg_match('/[^.\w-]/i', $new_name)) {
42+
return parent::error('file-alnum');
4143
} elseif ($this->lfm->setName($new_name)->exists()) {
4244
return parent::error('rename');
4345
}

0 commit comments

Comments
 (0)