Skip to content

Commit

Permalink
feat(homework/upload): add support for Blob and File
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Apr 19, 2024
1 parent 5081164 commit 57a29e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export class Session {
}
}

public writePronoteFileUploadPayload (buffer: ArrayBuffer | Buffer | Uint8Array) {
public writePronoteFileUploadPayload (buffer: ArrayBuffer | Buffer | Uint8Array | File | Blob) {
this.instance.order++;

const { aes_iv, aes_key } = this.getAESEncryptionKeys();
Expand All @@ -231,7 +231,7 @@ export class Session {
return {
order: order_encrypted,
fileID: `selecfile_1_${Date.now()}`, // `1` is a constant because we'll always upload only one file.
file: new Blob([buffer]),
file: buffer instanceof Blob ? buffer : new Blob([buffer]),

// We can either provide an MD5 or just give an empty string.
//
Expand Down

0 comments on commit 57a29e7

Please sign in to comment.