Fix file_source uploads

This broke in https://github.com/galaxyproject/galaxy/pull/11276,
which moved all URL style uploads to fetch_data, but didn't build the
right payload for ftp / file_source uploads.
This commit is contained in:
mvdbeek
2021-04-20 19:39:23 +02:00
parent d50579d37f
commit ed16d0a96f
2 changed files with 25 additions and 21 deletions
@@ -11,6 +11,7 @@ import LazyLimited from "mvc/lazy/lazy-limited";
import { findExtension } from "./utils";
import { filesDialog } from "utils/data";
import { getAppRoot } from "onload";
import axios from "axios";
const localize = _l;
@@ -85,20 +86,19 @@ export default {
}
});
if (list.length > 0) {
$.uploadpost({
data: this.app.toData(list),
url: this.app.uploadPath,
success: (message) => {
const data = this.app.toFetchData(list, this.history_id);
axios
.post("api/tools/fetch", data)
.then((message) => {
list.forEach((model) => {
this._eventSuccess(model.id, message);
});
},
error: (message) => {
})
.catch((message) => {
list.forEach((model) => {
self._eventError(model.id, message);
this._eventError(model.id, message);
});
},
});
});
}
},
renderNewModel: function (model) {
@@ -294,19 +294,23 @@ export default {
// Composite does not use the fetch API, so we can just
// index into the first element of items
const urls = items[0].get("url_paste").split("\n");
for (var index in urls) {
var url = urls[index].trim();
if (url != "") {
var element = {
url: urls[index].trim(),
src: "url",
dbkey: items[0].get("genome", "?"),
ext: items[0].get("extension", "auto"),
};
data.targets[0].elements.push(element);
}
const item = items[0];
let urls;
if (item.get("file_mode") == "ftp") {
urls = [item.get("file_path")];
} else {
urls = item.get("url_paste").split("\n");
}
urls.forEach((url) => {
if (url != "") {
data.targets[0].elements.push({
url: url.trim(),
src: "url",
dbkey: item.get("genome", "?"),
ext: item.get("extension", "auto"),
});
}
});
return data;
},
},