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

Replace special chars on pickAndStore #12

Open
fpereira1 opened this issue Jan 6, 2016 · 4 comments
Open

Replace special chars on pickAndStore #12

fpereira1 opened this issue Jan 6, 2016 · 4 comments

Comments

@fpereira1
Copy link

Hi,

I've been uploading files to a amazon s3 using the javascript library filepicker.io.

One problem I'm facing is that when users upload files with white spaces or fancy characters those files are not accessible through http

There's a work around for it described here: http://stackoverflow.com/a/16350423/280842

My issue with this workaround is that the callback on store is called slowly, so if your user changes pages in between your file will only exist in filepicker's records and not my database.

I am thinking that we can add an option to the pickerSettings called replaceFilenameSpecialChars so it becomes a setting for pickAndStore, would it be the right way to address this issue?

Thanks!

@krystiangw
Copy link
Contributor

@fpereira1
I agree it would be useful feature.
We consider adding even more powerful feature - onSelect callback.
Callback will be fired on each file selection with Blob object as attribute.
It can be used to validate file ( based on filename, mimetype, size and provider ) and to edit data ( filename, store path etc ).

This feature require changes on both filepicker-js library and dialog code. Here is feature branch. Work is on hold now but I will get back to it.

@fpereira1
Copy link
Author

Hi @krystiangw

Thanks for the reply.

If the onSelect callback allows for replacing the filename that would be great. It could be useful still to add an option to replaceFilenameSpecialChars on top of the onSelect callback.

I tried running the branch locally for checking the progress, but the onSelect is not being called.

It looks like the backend is not sending an event with the type filepickerSelected- Is that because it would require a change to the filepicker backend API?

@krystiangw
Copy link
Contributor

It needs changes in dialog js app. So you can't test it with production dialog now.
Here is how API will look like:

filepicker.pickMultiple(
    {
        // settings
    }
    onSuccess,
    onError,
    onProgress,
    onSelect
);

function onSelect(Blob){
    Blob.filename = Blob.filename.replace('special chars', '');
    return Blob;
}

@tigrang
Copy link

tigrang commented Jan 4, 2018

Is there any updates on this? Thanks.

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

3 participants