From 83140be9250cbd70530f7170d83a013b1cbbce38 Mon Sep 17 00:00:00 2001 From: Boris Sekachev <40690378+bsekachev@users.noreply.github.com> Date: Wed, 19 Feb 2020 23:38:46 +0300 Subject: [PATCH] Fixed dump for cases when special URL characters in task name (#1162) --- cvat-core/src/server-proxy.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cvat-core/src/server-proxy.js b/cvat-core/src/server-proxy.js index 018a58bdf962..25f101822cad 100644 --- a/cvat-core/src/server-proxy.js +++ b/cvat-core/src/server-proxy.js @@ -559,7 +559,9 @@ async function dumpAnnotations(id, name, format) { const { backendAPI } = config; const filename = name.replace(/\//g, '_'); - let url = `${backendAPI}/tasks/${id}/annotations/${filename}?format=${format}`; + const baseURL = `${backendAPI}/tasks/${id}/annotations/${encodeURIComponent(filename)}`; + let query = `format=${encodeURIComponent(format)}`; + let url = `${baseURL}?${query}`; return new Promise((resolve, reject) => { async function request() { @@ -569,7 +571,8 @@ if (response.status === 202) { setTimeout(request, 3000); } else { - url = `${url}&action=download`; + query = `${query}&action=download`; + url = `${baseURL}?${query}`; resolve(url); } }).catch((errorData) => {