Skip to content

Commit

Permalink
correct download
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 2, 2024
1 parent b906aeb commit 8c5ab97
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private void addWeights() {
int c = 0;
for (WeightFormat w : weights.gettAllSupportedWeightObjects()) {
try {
if (w.getSource() != null && checkURL(w.getSource())) {
if (w.getSource() != null) {
downloadableLinks.put(WEIGHTS_KEY + "_" + c ++, descriptor.getModelURL() + w.getSource());
if (w.getSourceFileName().endsWith(".zip"))
unzip = true;
Expand Down Expand Up @@ -347,20 +347,26 @@ private void addAttachments() {
int c = 0;
for (String kk : attachments.keySet()) {
if (attachments.get(kk) instanceof String) {
downloadableLinks.put(ATTACH_KEY + "_" + c ++, (String) attachments.get(kk));
downloadableLinks.put(ATTACH_KEY + "_" + c ++, descriptor.getModelURL() + (String) attachments.get(kk));
} else if (attachments.get(kk) instanceof URL) {
downloadableLinks.put(ATTACH_KEY + "_" + c ++, ((URL) attachments.get(kk)).toString());
downloadableLinks.put(ATTACH_KEY + "_" + c ++, descriptor.getModelURL() + ((URL) attachments.get(kk)).toString());
} else if (attachments.get(kk) instanceof Map) {
Map <String, Object> nFilesMap = (Map<String, Object>) attachments.get(kk);
for (String jj : nFilesMap.keySet()) {
if (nFilesMap.get(jj) instanceof String && checkURL((String) nFilesMap.get(jj)))
downloadableLinks.put(ATTACH_KEY + "_" + c ++, (nFilesMap.get(jj)).toString());
if (nFilesMap.get(jj) instanceof String)
downloadableLinks.put(ATTACH_KEY + "_" + c ++, descriptor.getModelURL() + (nFilesMap.get(jj)).toString());
}
} else if (attachments.get(kk) instanceof List) {
List <Object> nFilesList = (List<Object>) attachments.get(kk);
for (Object jj : nFilesList) {
if (jj instanceof String && checkURL((String) jj))
downloadableLinks.put(ATTACH_KEY + "_" + c ++, jj.toString());
if (jj instanceof String)
downloadableLinks.put(ATTACH_KEY + "_" + c ++, descriptor.getModelURL() + jj.toString());
else if (jj instanceof List) {
for (Object jjEntry : (List) jj) {
if (jjEntry instanceof String)
downloadableLinks.put(ATTACH_KEY + "_" + c ++, descriptor.getModelURL() + jj.toString());
}
}
}
}
}
Expand Down

0 comments on commit 8c5ab97

Please sign in to comment.