Skip to content

Commit

Permalink
Fix issue where session upload files contain zero data or are corrupt (
Browse files Browse the repository at this point in the history
…#2893)

* Fix issue where session upload files contain zero data or are corrupt
* Update documentation to clarify LDC use when building on ARMHF or ARM64
  • Loading branch information
abraunegg authored Oct 9, 2024
1 parent 52cd0af commit 5ea9369
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ as far as possible automatically, but can be overridden by passing
> [!IMPORTANT]
> For successful compilation of this application, it's crucial that the build environment is equipped with a minimum of 1GB of memory and an additional 1GB of swap space. To verify your system's swap space availability, you can use the `swapon` command. Ensuring these requirements are met is vital for the application's compilation process.
> [!NOTE]
> The 'configure' step will detect the correct version of LDC to be used when compiling the client under ARMHF and ARM64 cpu architectures.
```text
git clone https://github.com/abraunegg/onedrive.git
cd onedrive
./configure DC=/usr/bin/ldmd2
make clean; make
./configure; make clean; make;
sudo make install
```

Expand Down
12 changes: 11 additions & 1 deletion src/sync.d
Original file line number Diff line number Diff line change
Expand Up @@ -8470,6 +8470,9 @@ class SyncEngine {
void processForInterruptedSessionUploads() {
// For each upload_session file that has been found, process the data to ensure it is still valid
foreach (sessionFilePath; interruptedUploadsSessionFiles) {
// What session data are we trying to restore
if (verboseLogging) {addLogEntry("Attempting to restore file upload session using this session data file: " ~ sessionFilePath, ["verbose"]);}
// Does this pass validation?
if (!validateUploadSessionFileData(sessionFilePath)) {
// Remove upload_session file as it is invalid
// upload_session file file contains an error - cant resume this session
Expand Down Expand Up @@ -8508,7 +8511,14 @@ class SyncEngine {

// Try and read the text from the session file as a JSON array
try {
sessionFileData = readText(sessionFilePath).parseJSON();
if (getSize(sessionFilePath) > 0) {
// There is data to read in
sessionFileData = readText(sessionFilePath).parseJSON();
} else {
// No data to read in - invalid file
if (debugLogging) {addLogEntry("SESSION-RESUME: Invalid JSON file: " ~ sessionFilePath, ["debug"]);}
return false;
}
} catch (JSONException e) {
if (debugLogging) {addLogEntry("SESSION-RESUME: Invalid JSON data in: " ~ sessionFilePath, ["debug"]);}
return false;
Expand Down

0 comments on commit 5ea9369

Please sign in to comment.