Skip to content

Commit

Permalink
fix: date handling and multi-dropbox support
Browse files Browse the repository at this point in the history
  • Loading branch information
klieber committed Sep 5, 2020
1 parent 8a3e499 commit a088651
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/provider/dropbox/dropbox-client-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
create: async (config) => {
const tokenStore = new DropboxTokenStore(config.token_store);
let token = tokenStore.read();
let authorizationCode = process.env.DROPBOX_AUTH_CODE;
let authorizationCode = config.auth_code;

if (!token && !authorizationCode) {
logger.debug('no access token or authorization code available');
Expand Down
3 changes: 2 additions & 1 deletion lib/provider/dropbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ tmp.setGracefulCleanup();

const DEFAULTS = {
source: '/Camera Uploads',
token_store: './.dropbox-token'
token_store: './.dropbox-token',
auth_code: process.env.DROPBOX_AUTH_CODE
};

module.exports = {
Expand Down
4 changes: 3 additions & 1 deletion lib/support/date-extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ async function extractDateFromExif(filename) {
if (metadata) {
dateObject = metadata.DateTimeOriginal || metadata.DateTimeDigitized || metadata.CreateDate || metadata.ModifyDate;

if (!dateObject && metadata.GPSDateStamp) {
if (dateObject && (typeof dateObject === 'string' || dateObject instanceof String)) {
dateObject = new Date(dateObject);
} else if (!dateObject && metadata.GPSDateStamp) {
let gpsDate = metadata.GPSDateStamp.replace(/:/g, '-');
let gpsTime = metadata.GPSTimeStamp || '12:00:00';
dateObject = new Date(`${gpsDate}T${gpsTime}.000Z`);
Expand Down

0 comments on commit a088651

Please sign in to comment.