Skip to content

Commit

Permalink
Potentially resolve #2699
Browse files Browse the repository at this point in the history
* Update docker.md to clarify where to install Docker from
* Potentially resolve #2699 - needs testing by reporter
  • Loading branch information
abraunegg committed Apr 28, 2024
1 parent 0f0bc88 commit e1e35fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
5 changes: 3 additions & 2 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ Additionally there are specific version release tags for each release. Refer to
## Configuration Steps

### 1. Install 'docker' on your platform
Install 'docker' as per your distribution platform's instructions if not already installed as per the instructions on https://docs.docker.com/engine/install/
Install Docker for your system using the official instructions found at https://docs.docker.com/engine/install/.

> [!CAUTION]
> If you are using Ubuntu, do not install Docker from your distribution platform's repositories as these contain obsolete and outdated versions. You *must* install Docker from Docker provided packages.
> If you are using Ubuntu or any distribution based on Ubuntu, do not install Docker from your distribution's repositories, as they may contain obsolete versions. Instead, you must install Docker using the packages provided directly by Docker.

### 2. Configure 'docker' to allow non-privileged users to run Docker commands
Read https://docs.docker.com/engine/install/linux-postinstall/ to configure the 'docker' user group with your user account to allow your non 'root' user to run 'docker' commands.
Expand Down
20 changes: 17 additions & 3 deletions src/sync.d
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,8 @@ class SyncEngine {
string OneDriveFileXORHash;
string OneDriveFileSHA256Hash;
ulong jsonFileSize = 0;
Item databaseItem;
bool fileFoundInDB = false;

// Download item specifics
string downloadItemId = onedriveJSONItem["id"].str;
Expand Down Expand Up @@ -2205,8 +2207,6 @@ class SyncEngine {
// Does the file already exist in the path locally?
if (exists(newItemPath)) {
// file exists locally already
Item databaseItem;
bool fileFoundInDB = false;
foreach (driveId; onlineDriveDetails.keys) {
if (itemDB.selectByPath(newItemPath, driveId, databaseItem)) {
fileFoundInDB = true;
Expand Down Expand Up @@ -2348,6 +2348,7 @@ class SyncEngine {
} else {
// Downloaded file does not match size or hash .. which is it?
bool downloadValueMismatch = false;

// Size error?
if (downloadFileSize != jsonFileSize) {
// downloaded file size does not match
Expand All @@ -2356,6 +2357,7 @@ class SyncEngine {
addLogEntry("OneDrive API reported size: " ~ to!string(jsonFileSize), ["debug"]);
addLogEntry("ERROR: File download size mis-match. Increase logging verbosity to determine why.");
}

// Hash Error
if (downloadedFileHash != onlineFileHash) {
// downloaded file hash does not match
Expand All @@ -2364,6 +2366,7 @@ class SyncEngine {
addLogEntry("OneDrive API reported hash: " ~ onlineFileHash, ["debug"]);
addLogEntry("ERROR: File download hash mis-match. Increase logging verbosity to determine why.");
}

// .heic data loss check
// - https://github.com/abraunegg/onedrive/issues/2471
// - https://github.com/OneDrive/onedrive-api-docs/issues/1532
Expand All @@ -2390,10 +2393,21 @@ class SyncEngine {
// If the computed hash does not equal provided online hash, consider this a failed download
if (downloadedFileHash != onlineFileHash) {
// We do not want this local file to remain on the local file system as it failed the integrity checks
addLogEntry("Removing file " ~ newItemPath ~ " due to failed integrity checks");
addLogEntry("Removing local file " ~ newItemPath ~ " due to failed integrity checks");
if (!dryRun) {
safeRemove(newItemPath);
}

// Was this item previously in-sync with the local system?
// We previously searched for the file in the DB, we need to use that record
if (fileFoundInDB) {
// Purge DB record so that the deleted local file does not cause an online delete
// In a --dry-run scenario, this is being done against a DB copy
addLogEntry("Removing DB record due to failed integrity checks");
itemDB.deleteById(databaseItem.driveId, databaseItem.id);
}

// Flag that the download failed
downloadFailed = true;
}
}
Expand Down

0 comments on commit e1e35fa

Please sign in to comment.