Skip to content

Commit

Permalink
Fix date format in copy conditions (minio#623)
Browse files Browse the repository at this point in the history
Fix for x-amz-copy-source-if-modified-since and x-amz-copy-source-if-
unmodified-since values being sent in the wrong format to the server.
The server expects the date format to be in http.TimeFormat.
Also Fixed the format of the sample date in the unit test.

Fixes minio#620
  • Loading branch information
kannappanr authored and Krishna Srinivas committed Sep 13, 2017
1 parent 4dbbf73 commit 9ac99b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/minio.js
Original file line number Diff line number Diff line change
Expand Up @@ -2053,14 +2053,14 @@ export class CopyConditions {
if (!(date instanceof Date))
throw new TypeError('date must be of type Date')

this.modified = date.toISOString()
this.modified = date.toUTCString()
}

setUnmodified(date) {
if (!(date instanceof Date))
throw new TypeError('date must be of type Date')

this.unmodified = date.toISOString()
this.unmodified = date.toUTCString()
}

setMatchETag(etag) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Helpers', () => {
})

describe('CopyConditions', () => {
let date = '2017-08-11T19:34:18.437Z'
let date = 'Fri, 11 Aug 2017 19:34:18 GMT'

let cc = new Minio.CopyConditions()

Expand Down

0 comments on commit 9ac99b1

Please sign in to comment.