Skip to content

Commit

Permalink
fix: google drive, authorize instead of throwing error and return tex…
Browse files Browse the repository at this point in the history
…t instead of blob from drive file
  • Loading branch information
Suhas1104 committed Jul 7, 2024
1 parent 4457acd commit 736f666
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/application/sync/gdrive/drive.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Drive {

async readFile(id) {
const { data } = await this.drive.files.get({ fileId: id, alt: 'media' })
return data
return data.text()
}

async updateFile(id, content) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/application/sync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import GDrive from './gdrive'
import { mergeData } from './base/merge'

const NO_INTERNET_CONNECTION = 'Swifty seems to be offline'
const NOT_CONFIGURED = 'Sync is not configured'
const FAILED_TO_FIND_REMOTE_VAULT = 'Failed to find remote vault file'
const FAILED_TO_CREATE_REMOTE_VAULT = 'Failed to create remote vault file'
const FAILED_TO_READ_REMOTE_VAULT = 'Failed to read remote vault file'
Expand All @@ -19,7 +18,9 @@ export default class Sync {
}

async perform() {
if (!this.isConfigured()) throw Error(NOT_CONFIGURED)
if (!this.isConfigured()) {
this.provider.setup()
}

if (!(await this.remoteVaultExists())) {
await this.createRemoteVault()
Expand Down

0 comments on commit 736f666

Please sign in to comment.