Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm having problems with files that have spaces or _ (underscores) in them. #229

Open
rootedsoftware opened this issue Apr 19, 2016 · 2 comments

Comments

@rootedsoftware
Copy link

I was able to use this in my

UploadServer.init({
getFileName: function( fileInfo, formData ) {
      try {
        return fileInfo.name.replace(/[*_\s]/g, '');
      } catch(e) {
        throw new Meteor.Error(500, e);
      }
    });

To return the fixed file name, but the url includes the name with spaces and _ in them still. I'm sure I could use a collection.after to fix this in the collection, but I believe this is a bug.

@rootedsoftware
Copy link
Author

For anyone else that might need a temporary solution, here is what I am doing.

Uploads.before.insert(function (userId, doc, fieldNames, modifier) {
  // Remove spaces and underscores from the url
  doc.url = doc.url.replace( /[*_\s]/g, '' );
  return true;
});

@msj121
Copy link

msj121 commented May 6, 2016

Also having an issue. This should be fixed properly without removing spaces. I need files to remain the same since some files reference each other with relative urls. I can't expect users who upload files to assume all spaces will be removed so their files can reference each other....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants