Merge pull request #681 from transloadit/improvement/url

Check url in URL plugin
This commit is contained in:
Artur Paikin 2018-03-07 11:56:34 -05:00 committed by GitHub
commit f04b664cfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,8 @@ module.exports = class Url extends Plugin {
addUrl: 'Add url',
import: 'Import',
enterUrlToImport: 'Enter file url to import',
failedToFetch: 'Uppy Server failed to fetch this URL'
failedToFetch: 'Uppy Server failed to fetch this URL, please make sure its correct',
enterCorrectUrl: 'Please enter correct URL to add file'
}
}
@ -83,6 +84,12 @@ module.exports = class Url extends Plugin {
}
addFile (url) {
if (!url) {
this.uppy.log('[URL] Incorrect URL entered')
this.uppy.info(this.i18n('enterCorrectUrl'), 'error', 4000)
return
}
return this.getMeta(url).then((meta) => {
const tagFile = {
source: this.id,