commit f633f4b271798911efe2a85702b9cba774bf7741
parent 137af6069f0b02cc5f72db3d4bff6a975d546e47
Author: Sergey Orlov <wladimirych@gmail.com>
Date: Mon, 10 Aug 2020 11:16:07 +0200
track list: make SimpleService process only URLS
Diffstat:
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lib/leaflet.control.track-list/lib/loadFromUrl.js b/src/lib/leaflet.control.track-list/lib/loadFromUrl.js
@@ -7,7 +7,7 @@ async function loadFromUrl(url) {
return service.geoData();
}
}
- return null;
+ return [{name: url, error: 'INVALID_URL'}];
}
export default loadFromUrl;
diff --git a/src/lib/leaflet.control.track-list/lib/services/simpleService.js b/src/lib/leaflet.control.track-list/lib/services/simpleService.js
@@ -4,7 +4,7 @@ import urlViaCorsProxy from '~/lib/CORSProxy';
class SimpleService extends BaseService {
isOurUrl() {
- return true;
+ return Boolean(this.origUrl.match(/^https?:\/\/.+/u));
}
requestOptions() {
diff --git a/src/lib/leaflet.control.track-list/track-list.js b/src/lib/leaflet.control.track-list/track-list.js
@@ -333,7 +333,8 @@ L.Control.TrackList = L.Control.extend({
var error_messages = {
CORRUPT: 'File "{name}" is corrupt',
UNSUPPORTED: 'File "{name}" has unsupported format or is badly corrupt',
- NETWORK: 'Could not download file from url "{name}"'
+ NETWORK: 'Could not download file from url "{name}"',
+ INVALID_URL: '"{name}" is not of supported URL type',
};
var message;
if (geodata.error) {