Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where session upload files contain zero data or are corrupt #2893

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading