Skip to content

Commit

Permalink
Replace spaces in directory names
Browse files Browse the repository at this point in the history
  • Loading branch information
lehecht committed Jan 11, 2024
1 parent 9136021 commit 25c08f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/resources/assets/js/createContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default {
maxFilesizeBytes: 0,
exceedsMaxFilesize: false,
chunkSize: 0,
filenameContainsSpaces: false,
pathContainsSpaces: false,
};
},
computed: {
Expand Down Expand Up @@ -131,7 +131,7 @@ export default {
// See https://github.com/biigle/user-storage/issues/16.
let file = newFiles[i];
if (file.name.includes(' ')) {
this.filenameContainsSpaces = true;
this.pathContainsSpaces = true;
let newName = newFiles[i].name.replace(/ /g, '_');
file = new File([newFiles[i]], newName, { type: newFiles[i].type });
}
Expand Down Expand Up @@ -177,6 +177,10 @@ export default {
addDirectory(root) {
let name = prompt('Please enter the new directory name');
if (name) {
if (name.includes(' ')) {
this.pathContainsSpaces = true;
name = name.replace(/ /g, '_');
}
this.handleNewDirectory(name, root === true);
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/resources/views/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ class="btn btn-success"
Selected files with a total size of <span v-text="totalSizeForHumans"></span>.
</p>

<p v-cloak v-if="filenameContainsSpaces" class="text-warning">
Replaced spaces by underscores in file names.
<p v-cloak v-if="pathContainsSpaces" class="text-warning">
Replaced spaces by underscores.
</p>

<file-browser
Expand Down

0 comments on commit 25c08f1

Please sign in to comment.