Skip to content

Commit 83140be

Browse files
authored
Fixed dump for cases when special URL characters in task name (#1162)
1 parent 228b813 commit 83140be

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cvat-core/src/server-proxy.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,9 @@
559559
async function dumpAnnotations(id, name, format) {
560560
const { backendAPI } = config;
561561
const filename = name.replace(/\//g, '_');
562-
let url = `${backendAPI}/tasks/${id}/annotations/${filename}?format=${format}`;
562+
const baseURL = `${backendAPI}/tasks/${id}/annotations/${encodeURIComponent(filename)}`;
563+
let query = `format=${encodeURIComponent(format)}`;
564+
let url = `${baseURL}?${query}`;
563565

564566
return new Promise((resolve, reject) => {
565567
async function request() {
@@ -569,7 +571,8 @@
569571
if (response.status === 202) {
570572
setTimeout(request, 3000);
571573
} else {
572-
url = `${url}&action=download`;
574+
query = `${query}&action=download`;
575+
url = `${baseURL}?${query}`;
573576
resolve(url);
574577
}
575578
}).catch((errorData) => {

0 commit comments

Comments
 (0)