Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Remove unused size() and md5() methods - Remove unused findFile() private method - Remove unused imports (calculateMd5, MD5)
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for Google Drive as a new filesystem option, integrating it into the UI, authentication, and core filesystem factory.
- Introduce
GoogleDriveFileSystem,GoogleDriveFileReader, andGoogleDriveFileWriter. - Register “googledrive” in the filesystem selector and factory.
- Update backup-tools logic to handle empty lists without early return.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/options/routes/Tools.tsx | Change empty-list handling to an if/else instead of early return |
| src/pages/components/FileSystemParams/index.tsx | Add Google Drive entry to filesystem parameters |
| packages/filesystem/googledrive/rw.ts | Implement read/write classes for Google Drive |
| packages/filesystem/googledrive/googledrive.ts | Full Google Drive filesystem implementation |
| packages/filesystem/factory.ts | Register “googledrive” type and factory case |
| packages/filesystem/auth.ts | Extend NetDiskType to include “googledrive” |
Comments suppressed due to low confidence (1)
packages/filesystem/googledrive/googledrive.ts:107
- [nitpick] The parameter name
nothenis unclear; consider renaming it to something more descriptive likerawResponseorreturnRawResponsefor readability.
request(url: string, config?: RequestInit, nothen?: boolean) {
| @@ -162,9 +162,9 @@ function Tools() { | |||
| list = list.filter((file) => file.name.endsWith(".zip")); | |||
| if (list.length === 0) { | |||
| Message.info(t("no_backup_files")!); | |||
There was a problem hiding this comment.
Removing the early return changes control flow: after showing the info message, the function will continue instead of exiting. Consider re-adding a return or explicitly handling the post-empty-list logic to avoid unintended side effects.
| Message.info(t("no_backup_files")!); | |
| Message.info(t("no_backup_files")!); | |
| return; |
| }, | ||
| { | ||
| key: "googledrive", | ||
| name: "Google Drive", |
There was a problem hiding this comment.
[nitpick] The display name "Google Drive" is hardcoded; consider using a translation function (e.g. t('google_drive')) to keep it consistent with other localized strings.
| name: "Google Drive", | |
| name: t("google_drive"), |
| const data = await this.fs.request(`https://www.googleapis.com/drive/v3/files/${fileId}?alt=media`, {}, true); | ||
|
|
||
| if (data.status !== 200) { | ||
| return Promise.reject(await data.text()); |
There was a problem hiding this comment.
Rejecting with a raw string can make downstream error handling inconsistent; wrap the message in an Error object (e.g. Promise.reject(new Error(await data.text()))).
| return Promise.reject(await data.text()); | |
| return Promise.reject(new Error(await data.text())); |
No description provided.