Skip to content

Commit

Permalink
Update S3Request.gs
Browse files Browse the repository at this point in the history
edit to upload images instead of string (@link eschultink#8 (comment))
  • Loading branch information
tomkeysers authored Mar 18, 2022
1 parent c51afb9 commit cf0c83d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions S3Request.gs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ S3Request.prototype.getContentType = function () {
* @return {S3Request} this request, for chaining
*/
S3Request.prototype.setContent = function(content) {
if (typeof content != 'string') throw 'content must be passed as a string'
this.content = content;
return this;
};
Expand Down Expand Up @@ -390,7 +389,10 @@ S3Request.prototype.credentialString = function(datetime) {
}

S3Request.prototype.hexEncodedHash = function(string) {
return this.hex(Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, string, Utilities.Charset.UTF_8));
if(typeof string === "string")
return this.hex(Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, string, Utilities.Charset.UTF_8));
else
return this.hex(Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, string.getBytes()));
}

S3Request.prototype.hexEncodedBodyHash = function() {
Expand Down

0 comments on commit cf0c83d

Please sign in to comment.