Skip to content

Commit

Permalink
Fix store() bug
Browse files Browse the repository at this point in the history
  • Loading branch information
helamanl0424 authored Apr 11, 2024
1 parent 61aab07 commit 940ed09
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import * as fs from "fs";

const STORAGE_ENT_NAME : string = "__pods_storageURL";
const MODULE_NAME : string = "pods";
const MAX_FILE_SIZE : number = 500;
const CLIENT_ID_ENT_NAME : string = "__pods_clientID";
const CLIENT_SECRET_ENT_NAME : string = "__pods_clientSecret";
const TOKEN_URL_ENT_NAME : string = "__pods_tokenURL";
Expand Down Expand Up @@ -141,8 +140,7 @@ async function createFileObject(data : Blob, destinationURL : string, functionNa
throw MODULE_NAME + ":" + functionName + " detected a file name of length 0.";
}


let file = new File([data], <string>fileName)
let file = new File([data], <string>fileName);
return file;
}

Expand Down Expand Up @@ -261,13 +259,14 @@ const store = krl.Action(["originURL", "destinationURL", "doAutoAuth"],
}
}

let file : File = await getNonPodFile(this, [originURL, destinationURL, FUNCTION_NAME])

//let file : File = await getNonPodFile(this, [originURL, destinationURL, FUNCTION_NAME])
let file : Blob = await getBlob(originURL);
let filename = originURL.split('/').pop();
this.log.debug("Destination: " + destinationURL);

saveFileInContainer(
destinationURL,
file,
new File([file], `${filename}`),
{ fetch: authFetch }
)
.then(() => {
Expand Down Expand Up @@ -359,7 +358,7 @@ const copyFile = krl.Action(["originURL", "destinationURL", "doAutoAuth"],
.catch(error => {
this.log.error("Error copying file:", error);
});

} else {
const arrayBuffer = await file.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
Expand Down

0 comments on commit 940ed09

Please sign in to comment.