
Announcements
One of my portals uses blob storage for, well, file storage. Recently I noticed some files uploaded by users were not being processed due to Flow's inability to find them in the blob container.
Problem:
User uploaded a file named: my report 1:2:3.pdf
File reference in dataverse: my report 123.pdf
Filename in blob storage: my report 1:2:3.pdf
In Windows, a filename cannot contain a colon (:). Somehow users are generating the random filename, then uploading them to my portal. Dataverse is correcting the file but failing to do the same when pushing the file to the blob container.
Yes, I can adjust my Flow to rename the blob or maybe do some JS magic on the UI side, but why is dataverse and or the file mover not renaming the file before it lands in the container?
Real example:
not sure why this is being partially renamed, but my suggestion would be to add JS to your page to validate the file name
I have a function that might be a good start for you:
InvalidFilenameValidationError = function (inputName, errorMessage) {
var invalidCharacters = ['#', '%', '*', ':', '<', '>', '?', '/', '|', '\''];
var files = $("#" + inputName)[0].files;
//check that files has correct names
for (var i = 0; i < files.length; i++) {
var file = files[i];
for (var character = 0; character < invalidCharacters.length; character++) {
if (file.name.indexOf(invalidCharacters[character]) > -1) {
// show error here
return false;
}
}
}
return true;
};