Skip to content

Commit

Permalink
Wrap timestamp error to give better understanding of where the error …
Browse files Browse the repository at this point in the history
…came from
  • Loading branch information
SijmenHuizenga committed Sep 11, 2020
1 parent ec55039 commit fa6259b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -236,12 +237,12 @@ func (d *Downloader) downloadImage(item *LibraryItem, filePath string) error {
// close file to prevent conflicts with writing new timestamp in next step
output.Close()

//If timestamp is availabe, set access time to current timestamp and set modified time to the time the item was first created (not when it was uploaded to Google Photos)
//If timestamp is available, set access time to current timestamp and set modified time to the time the item was first created (not when it was uploaded to Google Photos)
t, err := time.Parse(time.RFC3339, item.MediaMetadata.CreationTime)
if err == nil {
err = os.Chtimes(filePath, time.Now(), t)
if err != nil {
return err;
return errors.New("failed writing timestamp to file: " + err.Error())
}
}

Expand Down

0 comments on commit fa6259b

Please sign in to comment.