Skip to content

Commit

Permalink
Fixed dump for cases when special URL characters in task name (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored Feb 19, 2020
1 parent 228b813 commit 83140be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cvat-core/src/server-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) => {
Expand Down

0 comments on commit 83140be

Please sign in to comment.