Commit graph

728 commits

Author SHA1 Message Date
abraunegg 928ad9512f
Check shared folder DB entries for matching skip_dir items (#1003)
* Check shared folder DB entries for matching skip_dir items
2020-07-28 07:00:34 +10:00
abraunegg 76ce1036a4
Update when 'Sync with OneDrive is ..' is outputted when in --monitor mode (#999)
* The original intention here was that 'Sync with OneDrive is ...' is outputted when the sync starts / ends in 'verbose' mode, and not added to when not using any 'verbose'. What is occurring is, this is being added when MONITOR_LOG_QUIET threshold is met, which was not the intention. This now fixes when this message is outputted so that it is more reflective of when a sync is being done, when in --monitor mode
2020-07-22 15:56:20 +10:00
abraunegg beb737e903
Fix segfault when moving file when using --monitor (#997)
* Fix segfault when attempting to perform a comparison on an inotify event when determining if event path is directory or file
2020-07-22 06:54:35 +10:00
Mateusz P-K f6002311cd
Improve --single-directory sync performance (#992)
* Remove erroneous 'return' statement which could prematurely end processing all changes returned from OneDrive
* Improve --single-directory sync performance

This commit modifies code inside applyDifferences function,
the part responsible for deleting changes/moving them out
of the selected sync directories. This change makes an HTTP
request responsible for checking whether a changed item still
exists on OneDrive only be sent only if it may in fact influence
whether an item will be deleted from the synced folder or not
or just discarded.

This makes an enormous performance boost, because it limits
redundant HTTP requests that ask about changed items that will
be discarded or not.

Signed-off-by: Mateusz P-K <mateusz.kaplon@gmail.com>
2020-07-21 15:19:41 +10:00
abraunegg 25fd9a1b00
Update the 'Processing XXXX' output to display the full path (#987)
* Update the 'Processing XXXX' output to display the full path, rather than just the item name from the database. In cases where you have the same file or directory name, having the full path where it is present is more informative
2020-07-07 19:51:05 +10:00
abraunegg 810c47fcfe
Increase maximum file size to 100GB (#989)
* In July 2020, Microsoft increased the maximum file size for uploads from 15GB / 20GB for Personal / Business Accounts to 100GB per file for all account types
2020-07-07 19:19:50 +10:00
abraunegg 8c0d43183d
Resolve client 'hang' when attempting to sync a Unix pipe file (#985)
* Resolve client 'hang' when attempting to sync a unix pipe file
2020-07-07 18:05:36 +10:00
abraunegg 48292a0858
Update 'skip_dir' and 'skip_file' pattern matching and handling for --monitor (#986)
* Update 'skip_dir' and 'skip_file' pattern matching and handling for --monitor
2020-07-07 17:39:09 +10:00
abraunegg e23e06305a
Update 'skip_dir' and 'skip_file' pattern matching and handling (Issue #982) (#983)
* Update 'skip_dir' and 'skip_file' pattern matching and handling
2020-07-07 05:17:03 +10:00
abraunegg 41d92ddab5
Process OneDrive Personal Shared Folders only if account type is 'personal' (#972)
* Update code to ensure that OneDrive Shared Folders are processed, only if account type is 'personal'
2020-06-28 10:57:21 +10:00
abraunegg 9cc72c2396
Implement OneDrive Business Shared Folders Support (Issue #459) (#473)
* Implement OneDrive Business Shared Folders Support
2020-06-27 19:10:37 +10:00
abraunegg 650cb97d3f
Simplify code for readability (#961)
* Remove buildNormalizedPath complexity and simplify code
2020-06-21 10:01:24 +10:00
abraunegg d8bfe846c2
Update documentation for --upload-only & --download-only to avoid ambiguity (#960)
* Update wording on --upload-only , --download-only to avoid ambiguity
* Update --upload-only usage example to include --no-remote-delete
2020-06-21 08:09:06 +10:00
abraunegg 93163051f5
Support comments in sync_list file (#958)
* If sync_list contains a comment line, exclude this from sync_list processing
2020-06-20 19:13:46 +10:00
abraunegg 1c10effb9b
Implement support for National cloud deployments (Issue #937) (#938)
* Implement support for National cloud deployments as per https://docs.microsoft.com/en-us/graph/deployments
2020-06-17 07:57:14 +10:00
Christian Ponte-Fernández 3b85d574e0
Implement recursive deletion when Retention Policy is enabled (#955)
* Implement recursive deletion when Retention Policy is enabled
2020-06-17 06:49:43 +10:00
Christian Ponte-Fernández 9e020f05cc
Fix segfault when moving folder outside the sync directory when using --monitor (#957)
Fix segfault when moving folder outside the sync directory when using --monitor on Arch Linux
2020-06-17 06:28:55 +10:00
abraunegg e321c373fd
Handle a 'race' condition to process inotify events (#948)
* Handle a 'race' condition to process inotify events generated whilst performing DB or filesystem walk
2020-06-12 06:46:59 +10:00
Liran 46c91bac6e
Added support for loading system configs if there's no user config. (#914)
* Added support for loading system configs if there's no user config file supplied. Uses application defaults if corrupt.
* Update documentation to indicate where config files can be stored & read from
2020-06-05 14:49:31 +10:00
abraunegg 203da2dfb8
Perform initial sync at startup in monitor mode (#946)
* If starting the application up, dont wait for monitor_interval to elapse before first sync attempt
2020-06-05 06:49:23 +10:00
abraunegg df361b261b
Update message output for performFullItemScan or oneDriveFullScanTrigger (#945)
* Update message output depending on if performFullItemScan or oneDriveFullScanTrigger was set
2020-06-05 06:45:19 +10:00
abraunegg b7f69e2541
Update logfile output spacing (#944)
* Update logfile output spacing
2020-06-05 06:00:42 +10:00
abraunegg 8376a360cc
Check if symbolic link is relative to location path (#942)
* If a symbolic link is 'relative', it is relative to the path where the symbolic link exists, not the current working directory. Test if the failed symbolic link read is due to the link being relative, and advise accordingly.
2020-06-02 13:46:57 +10:00
abraunegg d33443cb4f
Add inotify event debugging (#941)
* Add inotify event debugging
2020-05-29 19:30:03 +10:00
abraunegg f0c5ca95c6
Update logging output of skipped files (#932)
* Normalise output when specifying a particular file which is being skipped
2020-05-26 19:53:35 +10:00
abraunegg aee2052f1e
Strengthen data preservation checks & update how bypass preservation is set (#931)
* Strengthen bypass data preservation variable checks
* If a file is modified locally, and '--resync' is used, there is no way to tell if this file is a failed download or 'valid' thus potentially lead to a data loss scenario. In this case, and ONLY if --resync was issued, rename the local file for data preservation
2020-05-26 17:04:22 +10:00
abraunegg f9c3ccc311
Add developer option to display sync options (#924)
* It may be desirable to see what options are being passed in to performSync() without enabling the full verbose debug logging. This has been useful when tracking down 'sync_list' / sync issue & other performance related items without having to enable full verbose debugging to see what is going on
2020-05-25 11:30:04 +10:00
abraunegg 0096e7efce
Add file validation for moved / renamed files (#929)
* When renaming a file locally, ensure that the target filename is valid before attempting to upload to OneDrive
2020-05-25 10:51:57 +10:00
abraunegg b9dd8c754d
Add debugging output for retry wait time (#928)
* Add debugging output for retry wait time
2020-05-24 17:39:28 +10:00
abraunegg cd07414e7b
Change monitor interval default to 300 seconds (#923)
* Having a 45 second default between monitor sync loops is too short. If there are a large number of files on the system (30K+) local file integrity checks take longer than 1 minute to complete, thus, it will seem like the system is 'forever' processing. Changing this to 300 seconds between sync loops is a more sane default.
2020-05-21 11:08:07 +10:00
abraunegg fc90ccb425
Implement 'bypass_data_preservation' enhancement (Issue #824) (#831)
* On some Linux distributions, the file system search tool locally modifies certain files after indexing. Even though the file contents has not changed, the file itself has, as the local modified timestamp has been updated. This then causes timestamp checks to be invalid. To ignore this in cases where this is occurring, configure 'bypass_data_preservation' to 'true' in the config file and local data protection rules will be ignored.
* Add warning to application startup if 'bypass_data_preservation' has been enabled
2020-05-21 06:48:02 +10:00
abraunegg 060a42ab77
Remove double scan of OneDrive when using --monitor --resync at application startup (#920)
* Remove double scan of OneDrive when using --monitor --resync at application startup
2020-05-20 13:15:43 +10:00
abraunegg 206ab8f516
Resolve issues identified by Valgrind (#910)
* Resolve issues identified by 'valgrind' where possible
2020-05-20 11:37:11 +10:00
abraunegg 9933d459ed
Check if configuration file exists before trying to load it (#909)
* Check if configuration file exists before trying to load it
2020-05-20 11:31:30 +10:00
abraunegg 2f22d38cb0
Fix module std.digest.digest is deprecated (#916)
* Fix module std.digest.digest as this is deprecated when using DMD 2.092 and above
2020-05-12 10:50:36 +10:00
abraunegg 2529b99265
Update enforce statement for parent id database query (Issue #912) (#913)
* Update database enforce check with conditional check on parent drive ID. If the parent is a shared folder, the parent ID will never be in the database as we are never provided that parent ID.
2020-05-10 05:42:46 +10:00
abraunegg cb06395a46
Catch unhandled MonitorException when inotify throws an error (Issue #903) (#905)
* Catch uphandled MonitorException when inotify throws an error
* Change monitor loop init full scan to false at start as fullScanOverride now correctly handled, negating need to true-up at application start
* Handle '100 Continue' response during upload
* Update handling of delta link being expired
* Update progress bar handling for uploads as #888 changed bar dynamics
2020-05-06 07:20:13 +10:00
abraunegg eda3d3c4bb
Better handle out-of-space message (#907)
* Better handle out-of-space message when OneDrive is out of space
2020-05-05 15:04:59 +10:00
abraunegg dcc0322cac
Update how './' is stripped from a path before check if excluded (Issue #901) (#902)
* Update how './' is stripped from a path before check if excluded
2020-05-02 04:46:44 +10:00
abraunegg bc9f2cf893
Update handling of fullScanRequired and syncListConfiguredFullScanOverride (Issue #896) (#899)
* Change 'syncListConfigured' to 'syncListConfiguredFullScanOverride' as this is what this variable
* Update handling of fullScanRequired and syncListConfiguredFullScanOverride
* When a 429 or 504 is generated when querying for 'changes' inside a changeset bundle, dont restart scanning changes from the beginning, retry original request after a delay
2020-05-02 04:05:06 +10:00
abraunegg a61d291340
Update #658 & #865 handling as when to setOneDriveFullScanTrigger (Issue #896) (#898)
* Change output for debugging
* Update setOneDriveFullScanTrigger to only be used when sync_list or skip_dir is used
* Unset oneDriveFullScanTrigger when it is currently set and no longer needed
2020-04-28 10:56:44 +10:00
abraunegg 73f71f6d52
Fix assertion when attempting to compute complex path (Issue #890) (#891)
* Before attempting to compute the complex path, check if the parent details are in the database
* Handle --dry-run and --no-remote-delete for shared folders
2020-04-27 20:59:35 +10:00
abraunegg c05243444f
Update progress bar to be more accurate when downloading large files (#888)
* Change from round to floor, so % bar increases when downloaded data is at X% not potentially under, thus leading to under reporting
* Add debug output when each % increase when downloading a file to assist with validating progress
* Start displaying ETA starting at 5% rather than 10%
2020-04-26 06:52:29 +10:00
abraunegg 628c58ad58
Catch unhandled curl exception on operationTimeout being exceeded (#886)
* Catch unhandled curl exception on operationTimeout being exceeded
2020-04-23 10:25:41 +10:00
abraunegg ccbeae4942
Implement resync in config option (Issue #874) (#875)
* Implement the ability to set --resync as a config option, default is false
2020-04-20 13:03:36 +10:00
abraunegg 2a7e48b823
Differenciate between OneNote objects and other unsupported objects (#870)
* Differenciate between OneNote objects and other unsupported objects
2020-04-15 14:54:21 +10:00
abraunegg d3aa0032bc
Perform full scan of OneDrive when required to ensure consistent local state (Issue #865) (#867)
* Use the configured 'fullScanRequired' every 10th loop to ensure that the local repository actually is in sync with OneDrive when sync_list is not used
* Use 'oneDriveFullScanTrigger' if it is set to trigger a full scan earlier than wait for next full sync if in monitor mode
2020-04-15 14:29:50 +10:00
abraunegg 7ca1ff95a8
Update handling of folders that cannot be read if parent should be skipped (#866)
* If a directory cannot be accessed, and is in a folder that should be skipped, do not print warning
2020-04-15 14:07:58 +10:00
abraunegg 7a18393ed0
Update skip_dotfiles handling of .folders when in monitor mode (#848)
* Prevent monitoring files inside .folders when using skip_dotfiles in monitor mode
* Handle '.folder' -> 'folder' move when skip_dotfiles is enabled
2020-04-06 20:05:06 +10:00
abraunegg 31629e697f
Update error logging output to be consistent (#860)
* Update error logging to be consistent when initialising fails
* Update error logging output to handle HTML error response reasoning
2020-04-06 19:40:42 +10:00
abraunegg c41adda7a0
Handle zero-byte modified files for OneDrive Business (#854)
* OneDrive does not support the uploading of zero-byte files when uploading via the OneDrive Web UI, however it is possible to upload then via the API as a 'new file'. If a local zero-byte file is modified, upload this as a 'new file' rather than attempt to upload as a normal modified file.
2020-04-02 19:25:22 +11:00
abraunegg 9ae6f8e808
Handle .nosync directive when downloading new files (Issue #827) (#842)
* Handle .nosync directive when downloading new files to an existing directory that is (was) in sync
* Handle the situation where a .nosync is created after some sort of partial download, so that the file, whilst now unwanted, is not downloaded
2020-04-02 07:39:02 +11:00
abraunegg 0170884bd1
Update --single-directory handling for --dry-run and --resync (#856)
* Update --single-directory handling when using --dry-run
* Update --single-directory handling when using --resync and items to sync are in a child folder rather than root, leading to parent database issues (foreign key constraint)
2020-04-02 06:56:50 +11:00
abraunegg 50fb2d8bfa
Update application output when using --dry-run and --resync and database is corrupt (Issue#844) (#845)
* Update application output when database is corrupt and how to resolve by using --resync
* Handle --dry-run and --resync correctly - do not copy the database, it may be corrupt
* Always check if items-dryrun.sqlite3 still exists, remove it as it maybe corrupt when --dry-run is used
2020-03-30 06:55:27 +11:00
TheOnlyTrueJonathanHeard 3708828806
Handle renaming dotfiles to another dotfile when skip_dotfile=true in monitor mode (#843)
* Handle renaming dotfiles to another dotfile when skip_dotfile=true in monitor mode

With thanks to @TheOnlyTrueJonathanHeard
2020-03-29 07:08:01 +11:00
GeorgeKalovyrnas caf51886cf
Escape parentheses from path or file names (#841)
* Escape parentheses from path or file names, when doing comparison with regex

With thanks to @GeorgeKalovyrnas
2020-03-28 07:49:33 +11:00
TheOnlyTrueJonathanHeard 7170498a95
Handle renaming files to a name starting with a dot when skip_dotfile=true (#838)
* Handle renaming files to a name starting with a dot when skip_dotfiles = true

With thanks to @TheOnlyTrueJonathanHeard
2020-03-28 07:20:00 +11:00
abraunegg feb3d96a7e
Release files for 2.4.0 (#833)
* Release files for 2.4.0
2020-03-23 09:18:06 +11:00
abraunegg 6f85d539da
Update client identifier and auth scopes (Issue #769) (#770)
* Update the client identifier to 'd50ca740-c83f-4d1b-b616-12c519384f0c'
* Update User Agent identifier to comply with OneDrive traffic decoration requirements
* Provide 'config' file option to modify / update client identifier to override application default
2020-03-23 07:01:51 +11:00
abraunegg 896a4676f5
Update regex parsing of response URI (#830)
* Update regex that extracts the response code from the response URI to avoid potentially generating a bad request to OneDrive, leading to a 'AADSTS9002313: Invalid request. Request is malformed or invalid.' response. With thanks to @zfil for fix.
2020-03-21 07:20:19 +11:00
abraunegg edd365d21b
Update error response handling for catching HTTP 429 responses - activityLimitReached (Issue #815) (#816)
* Overhaul OneDrive error response handling for 429 errors by utilising the HTTP response header Retry-After to configure the correct 'retry' window. If no retry window is set, defaults to 120 seconds.
* Update error response messaging when a 429 response is received
* Update how the original OneDrive query is retried when a 429 response is received
* Update the User Agent string to be more compliant with OneDrive decoration requirements to assist in avoiding 429 responses due to incorrect User Agent string being used. Updated to: ISV|abraunegg|OneDrive_Client_for_Linux/v%version_tag%
2020-03-20 06:12:47 +11:00
abraunegg 1e8395fb73
Handle moving files into a skipped .folder when skip_dotfiles = true (#828)
* If skip_dotfiles = true, moving files into a skipped .folder should not throw an error and should be removed from their previous location on OneDrive
* Add log message to indicate why delete operation is occurring on item which was moved
2020-03-20 05:35:21 +11:00
abraunegg 4cb0ebbfde
Update logging output (Issue #818) (#819)
* Tighten up the logging output to better clarify what is occurring when sync_list is being used
2020-03-15 06:58:57 +11:00
abraunegg b1fcb814c3
Update application output when just authorising application (Issue #820) (#821)
* Update application output to be clearer when just authorising the application and --synchronize or --monitor not passed in
* Update usage.md with updated authorize details and example
2020-03-15 06:29:44 +11:00
abraunegg 1bb4ed765c
Always log when a file is skipped due to the item being invalid (Issue #811)
* If an item is to be skipped due to being 'invalid' log this without the requirement of --verbose
2020-03-06 09:20:47 +11:00
abraunegg a4d72fc73c
Catch when OneDrive throws an error response on initialising (Issue #802) (#804)
* Catch when OneDrive throws an error response (40x, 50x) on initialising
2020-03-02 12:54:56 +11:00
abraunegg 76b80e953e
Update file handling when a failed download has occured due to CTRL-C (#800)
* If CTRL-C is used when downloading a file, remnants of this file may still exist when next sync occurs. If the file is not present in the local cache database, redownload the file from OneDrive. Does not impact however if --local-first directive is being used.
2020-02-15 10:02:29 +11:00
abraunegg fc6e2d9cfe
Catch 429 HTTPS return code when query for oneDriveRootDetails fails (#796)
* Catch 429 HTTPS return code when query for oneDriveRootDetails fails & provide error feedback that this was the reason why application initialization failed
2020-02-12 06:16:38 +11:00
abraunegg 2321518faa
Update how the 'username' is determined from the running process for logfile naming (Issue #786) (#787)
* Fix an issue where the 'username' for the running process is not correctly determined on some platforms when enabling logging via --enable-logging
2020-02-03 09:10:57 +11:00
abraunegg 14cd47b56f
Implement #699 - Perform skip_dir explicit match only (#768)
* Implement #699 - Perform skip_dir explicit match only
2020-01-29 16:37:50 +11:00
abraunegg f2fe718389
Implement #763 - Delete local files after sync (#767)
* Implement #763 - Delete local files after sync
2020-01-27 08:42:00 +11:00
abraunegg 5c2ad041bd
Implement warning on big deletes to safeguard data on OneDrive (#621)
* When testing changes to onedrive client configuration, the new configuration might be invalid (see #458 for example) and you remove all your data on OneDrive accidentally. This new feature attempts to protect your data on OneDrive when performing large deletes, so that a large delete is detected and asks for confirmation before actually processing this request. This feature does not impact `--monitor` mode of operation, only standalone mode of operation.
2020-01-03 07:46:58 +11:00
abraunegg 8549719df3
Fix --dry-run output to be consistent when using --upload-only & --no-remote-delete (Issue #758)
* Fix --dry-run output when using --upload-only & --no-remote-delete and deleting local files
2019-12-30 10:17:10 +11:00
abraunegg 217d72486d
Change synclist override flag to false as default when not using sync_list (#745)
* Set 'syncListConfiguredOverride' to false by default, only set to true at start if sync_list is true
* Remove logAndNotify as it is excessive for each change bundle to inform the desktop
* Add a log entry when a monitor sync loop with OneDrive starts & completes
2019-12-17 05:32:38 +11:00
abraunegg 8ecd1989b4
Fix where an item now out of scope should be flagged for local delete (#733)
* Fix where an item now out of scope should be flagged for local delete
2019-11-23 11:20:58 +11:00
Norbert Preining 133c45e545 Catch DNS resolution error (#730)
* Catch the DNS error the same way we catch the timeout error
2019-11-23 06:43:28 +11:00
abraunegg db5ceccffb
Check database for excluded sync_list items previously in scope (Issue #723) (#724)
* When using sync_list and files are moved out of sync scope online via OneDrive website, check if the item was previously in-sync in database. if true, flag for local delete.
* Rework fix for #568 so that if a directory is moved / created in sync_list scope, on the 'true-up' sync, any files that were moved with the folder are now downloaded
* Update when sync_list override is done
* Add debugging for each loop for sync_list scan handling
2019-11-21 19:58:34 +11:00
abraunegg 387bd53438
Add debug message to when a message is sent to dbus or notification daemon (#728)
* Add debug message when message is sent to notify daemon
* Update usage document to detail how to enable non-root systemd usage + notifications
2019-11-21 18:59:45 +11:00
abraunegg 0445ae03d3
Update Microsoft restriction and limitations (#725)
* Update Microsoft restriction and limitations about windows naming files to include '~' for folder names
2019-11-14 11:53:07 +11:00
abraunegg c876b9c575
Retry session upload fragment when transient errors occur to prevent silent upload failure (#721)
* When uploading data to OneDrive via a session, and OneDrive throws an exception response, retry the fragment upload instead of silently failing without any error message
* Add error message & error logging when uploading data via a session and OneDrive throws an exception
2019-11-11 20:27:34 +11:00
abraunegg 7b4ba2e5d2
Only monitor top level single directory + its children if using --single-directory (Issue #709)
* If --single-directory is being used, and we are using --monitor, only set inotify watches on the single directory
2019-11-02 10:41:18 +11:00
Tudor Brindus 7ba59e0b1d Fix --monitor when used with --download-only (#708)
* Fix --monitor when used with --download-only. This fixes the regression introduced in 12947d160f.
2019-10-31 14:59:44 +11:00
abraunegg df3fba1be0
Catch a 412 response when moving files (Issue #706) (#707)
* Catch a 412 response when moving files right after upload.
2019-10-31 12:58:09 +11:00
abraunegg 12947d160f
Fix unhandled monitor initialisation exception (Issue #704) (#705)
* Catch MonitorException when initialisation failure occurs, print error and exit ... cant enter monitor loop if we cant initialise correctly.
* Cleanup and add documentation update
2019-10-30 17:46:02 +11:00
abraunegg 9b3179540f Revert "Fix unhandled monitor initialisation exception"
This reverts commit e1be2b1e55.
2019-10-30 06:33:11 +11:00
abraunegg e1be2b1e55 Fix unhandled monitor initialisation exception
* Catch MonitorException when initialisation failure occurs, print error and exit ... cant enter monitor loop if we cant initialise correctly.
2019-10-30 06:32:17 +11:00
abraunegg fec892b038
Fix call from --monitor to observe --no-remote-delete (#703)
* Fix call from --monitor to observe --no-remote-delete
2019-10-30 05:09:40 +11:00
abraunegg e99872eaa2
Fix 'Key not found: name' when computing skip_dir path (#701)
* OneDrive API difference between Personal & Business where some Business accounts do not send 'name' key with parent reference. Check for existance of 'name' key before use.
2019-10-26 14:17:40 +11:00
abraunegg 585b35724f
Reduce change scan impact of fix for #658 (#691)
* If there are delta changes (meaning something changed on OneDrive) process the changes that have been presented
2019-10-23 05:29:11 +11:00
abraunegg 1ab36f4014
Update skip_dir pattern matching when using wildcards (Issue #689) (#692)
* Better handle skip_dir searching when wildcards are involved by passing in a better 'path' snippet from which to compare skip_dir entries against
* Enhance the directory to 'search' to include simple & complex matching in case long paths are used as part of skip_dir
2019-10-22 14:08:17 +11:00
abraunegg cfdb295823
Fix typo - retrySucess -> retrySuccess
* Fix typo - retrySucess -> retrySuccess
2019-10-21 18:53:00 +11:00
Rob A 44576ea4ca Handle curl exceptions and timeouts better with backoff/retry logic (Issue #693) (#695)
* Handle curl exceptions and timeouts better with backoff/retry logic
2019-10-21 18:04:08 +11:00
abraunegg cdad8631ec
Update JSON logging output (#696)
* Update invalid JSON object output handling as this really should be debug messaging not error messages
2019-10-21 13:25:52 +11:00
abraunegg 6a8d575941
Modify 'Processing X changes' output to be more reflective of actual activity (Issue #679) (#680)
* When using 'sync_list' do not output that we are processing 'changes' as this is misleading.
* When using sync_list perform a full scan only the first time when using --synchronize & --monitor to avoid double processing of all OneDrive items each and every time
* When using sync_list and --monitor only perform a full object scan when we are also configured to perform a full scan
2019-10-09 12:02:17 +11:00
abraunegg 808a2f331b
Fix log output to be consistent
Fix log output to be consistent with sync_list exclusion
2019-10-08 18:11:37 +11:00
abraunegg 5da97d0757
Fix typo - skip_list -> sync_list
Fix typo - skip_list -> sync_list
2019-10-08 17:48:51 +11:00
abraunegg 57cf29783a
Fix handling of skip_dir, skip_file & sync_list config options (#686)
* config option skip_dir should only be applied to directories
* config option skip_file should only be applied to files
* If 'directory' is in 'skip_file' then upload skip reason erroneously lists sync_list as reason for skipping
* update log output when something is excluded
* where a path is to be excluded via sync_list, only exclude via sync_list & not check skip_dir & skip_file as well
2019-10-08 17:34:35 +11:00
abraunegg ca9a6b6ac0
Make user-agent string a configuration option (#673)
* Make user-agent string a configuration option
* Set default User-Agent to OneDrive Client for Linux v{version}
* Add 'user_agent' to default config file
2019-09-24 16:42:40 +10:00
Jon Mills 3aa4d4965e Return remote name when 'case-insensitive match' (#670)
If there is a case-insensitive match error, also return the remote name from the response
2019-09-23 17:35:18 +10:00
abraunegg fd4547376c
Fix crash when resume_upload file is not a valid JSON (#664)
* Validate that there is JSON data in the string before the string is read via parseJSON()
* Add try block to catch file system exceptions if they are generated when attempting to update the file date & time
2019-09-22 06:40:39 +10:00
abraunegg 72467e32ca
Update OneDrive API status code 500 handling (#661)
* Update OneDrive API status code 500 handling when uploading files as error message is not correct
2019-09-17 11:15:03 +10:00
abraunegg 2abc05af1d
Query for all changes if using sync_list file (#659)
* If we are using a sync_list file, using deltaLink will actually 'miss' changes (moves & deletes) on OneDrive as using sync_list discards changes
2019-09-16 05:06:02 +10:00
abraunegg e32b8b3c7f
Move logging of 'initialisation' to actually when the attempt to initialise is performed (#656)
* Move logging of 'initialisation' to actually when the attempt to initialise is performed
2019-09-11 20:26:21 +10:00
abraunegg 42d8c454e2
Fix downloading of files from OneDrive Personal Shared Folders (Issue #635) (#637)
* Fix downloading of files from OneDrive Personal Shared Folders when the OneDrive API responds with unexpected additional path data
2019-09-09 12:30:59 +10:00
abraunegg 0424caaaf8
Fix abnormal termination when no internet connection (#643)
* Fix abnormal termination when no internet connection
2019-09-06 13:12:13 +10:00
abraunegg 90a28e0f6c
Fix 'key not found: name' when checking if item was synced (#645)
* Fix searching for 'name' when deleting a synced item, if the OneDrive API does not return the expected details in the API call
2019-09-06 12:30:33 +10:00
abraunegg 5cd860a398
Fix handling of 5xx responses from OneDrive when uploading via a session (Issue #632) (#631)
* Fix handling of 5xx responses from OneDrive when performing a session upload
* Switch to same checks when doing non session upload so that OneDrive exceptions are thrown correctly
* Remove a 'throw e' when curl times out
* Remove a needless 'throw e' when a session upload cannot be found
* Set the upload failed flag when OneDrive errors on session uploads
2019-08-31 05:27:49 +10:00
abraunegg eb04ad5ffa
Remove redundant logging output (#627)
* Remove redundant logging output
2019-08-24 17:28:16 +10:00
abraunegg ad0daf2df5
Detect the need for --resync when config changes (#617)
* Detect the need for --resync when config changes either via config file or cli override
2019-08-24 17:18:58 +10:00
abraunegg bc3853bc4f
Add additional JSON object validation (#623)
* Add additional JSON object validation for queries made against OneDrive where a JSON response is expected and where that response is to be used and expected to be valid
2019-08-24 16:26:08 +10:00
abraunegg 488f756ecd
Fix unhandled error exceptions that cause application to exit / crash when uploading files (Issue #624) (#625)
* Remove 'else throw e' which causes the application to exit / crash and replace with what the actual error message is from OneDrive
* Make logging of unhandled errors consistent
* Add extra error handling when uploading files for errors received from OneDrive or file system errors
* Flag that the upload failed if there is an exception error raised
* Update logging output for when an error occurs to indicate that the file was skipped
* Log the OneDrive response as log.vlog rather than log.error as it is now being handled correctly
* Throw an exception for 50x errors so that it gets caught correctly
* Clean up logging when exception is generated
2019-08-24 15:54:48 +10:00
abraunegg 437fe4d9e4
Remove double logging output for a OneDrive 412 error (#622)
* Remove this logging output as it creates a double entry
2019-08-22 20:07:33 +10:00
abraunegg 893e235151
Catch a 403 Forbidden exception when querying Sharepoint Library Names (#620)
* Catch a 403 Forbidden exception when attempting to query for an Office 365 Shared Library Name
* Validate that the returned response is a valid JSON object
* Update scopes as per https://github.com/OneDrive/onedrive-api-docs/issues/1119
* Update that if a 403 error is received, what is the right course of action to take
2019-08-09 18:14:10 +10:00
abraunegg 4e97f8810d
Implement --get-file-link (#612)
* Implement --get-file-link which will return the weburl of a file which has been synced to OneDrive
2019-08-02 18:43:31 +10:00
abraunegg 100e644ae0
Catch error when creating sync dir fails (#608)
* Catch error when creating the sync dir fails - we cant run if this is not created or present
2019-07-31 07:20:26 +10:00
abraunegg 8f71043f23
Add a check to handle moving items out of sync scope & delete locally if true (#604)
* Add a check to handle moving items out of sync scope & delete locally if true
2019-07-30 07:02:24 +10:00
abraunegg 3171318503
Resolve file / folder upload issues (Issue #598) (#602)
* Without this throw, uploadLastModifiedTime fails to catch that the 412 error was returned, thus, the retry with a null cTag / eTag is not performed which leads to 'OneDrive response missing required 'id' element' being generated.
* Fix 'Unexpected character '<'. (Line 1:1)' when OneDrive has an exception error
* Validate that the response from OneDrive is a valid JSON object
2019-07-27 05:24:59 +10:00
abraunegg b41c5eb05d
Update Sharepoint modified file handling for files > 4Mb in size (#594)
* Update Sharepoint modified file handling for files > 4Mb in size
2019-07-17 05:11:38 +10:00
abraunegg 56644c4cbf
Update Sharepoint Document Library modified file handling (#590)
* Update Sharepoint Document Library handling for .txt & .csv files
* Use replace function for modified Sharepoint Document Library files rather than delete and upload as new file, preserving file history
2019-07-14 07:12:27 +10:00
abraunegg 66764f279d
Add explicit check for hashes being returned from OneDrive (Issue #591) (#592)
* Add explicit check for hashes to be returned in cases where OneDrive API fails to provide them despite requested to do so
* Add comparison with sha1 if OneDrive provides that rather than quickXor
2019-07-13 15:42:35 +10:00
abraunegg 68c6c5d75d
Fix hidden directories in 'root' from having prefix removed (#586)
* Fix hidden directories in 'root' from having prefix removed
2019-07-12 13:12:26 +10:00
Norbert Preining ab7e321726 Remove -d shorthand for --download-only (#577)
* Remove -d shorthand for --download-only to avoid confusion with other GNU applications where -d stands for 'debug'
2019-07-10 13:23:44 +10:00
Matthew Fallon f39621c2da Change unauthorized-api exit code to 3 (Issue #567) (#572)
* Changes unauthorized-api exit code to 3
* Systemd will not restart on exit code 3
2019-07-06 08:01:04 +10:00
abraunegg 80675aa8b4
Fix unable to download all files (Issue #563) (#568)
* Update logging output for better clarity
* Update logging output from vdebug -> error for errors
* Remove restrictive checks on fileDetails - if missing, continue, not return
* Add debug lines for if / when this is missing
2019-07-05 16:17:06 +10:00
abraunegg 1d02b3cb7a
Fix not all files being downloaded due to query failure & false DB update (#564)
* If query for file details or file object generates an error, we return, but we also need to flag that downloadFailed = true so that item is not added to the database which may cause validation issues leading to thinking that the file was downloaded but then deleted
2019-07-03 18:33:51 +10:00
abraunegg 4a4611ccea
Update fix for Issue #555 (#559)
* Update fix for #555 as try | catch block for session creation appears to miss error response codes
* Update how JSONValue object is determined to be valid
* Add error logging when response is not a valid JSON object
2019-06-30 10:12:25 +10:00
abraunegg 2f3804a3c0
Add download size & hash check (Issue #558) (#560)
* Check if the file that was downloaded to local disk equals the reported size & reported hash of the file on OneDrive. If sizes do not match, report an error and remove the local file as it is most likely corrupt.
2019-06-28 13:13:32 +10:00
abraunegg 15a2749382
Handle OneDrive error response on creating upload session (#556)
* Add a try block when attempting to create the upload session and handle if there is an error response from OneDrive
* Should return a JSONValue regardless of error
2019-06-27 18:40:18 +10:00
abraunegg d939d38c4f
Implement HTTP/2 downgrade by default (#549)
* Implement HTTP/2 downgrade by default to increase application stability when using curl >= 7.62
2019-06-21 01:11:29 +10:00
abraunegg bb2986b222
Add object check for json value (#551)
* Add explicit check that variable is a valid object
* Add default handling if query throws an error
2019-06-21 00:45:04 +10:00
abraunegg 10dd0300e3
Update issue #540 fix (#543)
* Update how and when filesize is configured and used before file download
2019-06-18 10:32:27 +10:00
abraunegg 687080d435
Size check should only be used if configured (Issue #540) (#541)
* Size check should only be used if configured
* Rather than make 2 x calls to OneDrive service, driveItem already has the size value to check
* Add a try block when query for file details
2019-06-17 10:16:27 +10:00
abraunegg bbf35f12ea
Handle a directory in the sync_dir when no permission to access (Issue #532) (#536)
* Handle a directory in the sync_dir when no permission to access
* Log the error during sync rather that only in verbose mode
2019-06-15 09:23:32 +10:00
abraunegg 7cf2912d2d
Rework directory layout and refactor MD files for readability (#523)
* Move lots of stuff into contrib directory to clean up root folder
* Update autoconf files for new location of some files
* Refactor README split and move to docs directory
* Update INSTALL.md
* Update Makefile.in
* Install docs from new location
* Uninstall docs correctly
* Update Dockerfile
* Fix up Dockerfile spacing
* Move systemd stuff to contrib
* Move docker specific stuff to contrib/docker, update docs
* Fix Alpine and Stretch docker files
* Update configure after changed file locations
* Update INSTALL.md to include pkg-config as requirement
* Move also entrypoint.sh to contrib/docker
* Update 'min-notif-changes' to 'min-notify-changes' which was missed in PR #467
* Update to add --sync-root-files to usage.md and man page
* Update usage.md to include --auth-files ARG details
2019-06-11 18:40:05 +10:00
Norbert Preining aa2e2245f0 Support file based authorization (Issue: #524) (#525)
* support file based authorization
* remove generated files after authentication
2019-06-11 17:12:36 +10:00
luukvbaal ef6af8e5bc implement skip_size (Issue #213) (#517)
* Implement skip_size feature request (@luukvbaal)
2019-06-08 06:37:41 +10:00
abraunegg c617185c14
Update missing cTag patch (Issue #512) (#515)
* Update original patch to check for eTag in response to use, if not found set to empty value.
* Add cTag response validation for all cTag response use 'in-case' the cTag response is dropped from other responses
2019-06-03 10:43:16 +10:00
abraunegg 8d4a35e34d
Handle OneDrive API response when cTag key is missing (Issue #512) (#513)
* Handle response from OneDrive where cTag JSON elements are missing when uploading a locally modified file
* Update bug_report.md to fix up spelling errors
2019-05-30 12:41:26 +10:00
abraunegg bac9ab41ae
Enhance error message for curl CA SSL issue (Issue #507) (#508)
* Enhance error message when unable to connect to Microsoft OneDrive service when the CA SSL certificate has issues
2019-05-24 19:17:08 +10:00
abraunegg 239085f1fc
Check timestamp to ensure that latest timestamp is used when comparing OneDrive changes (Issue #505) (#506)
* If OneDrive presents a change to download and the file already exists, check the local modified timestamp to ensure that the local file is not technically newer than the file we are going to download
2019-05-23 05:38:32 +10:00
abraunegg 20eda60fdf
Catch a curl timeout exception (#499)
* Catch a curl timeout exception
* If we hit a curl exception, log that we hit this, as the handling of the exception in 'some' instances may actually not log an error as to 'why'
2019-05-13 09:10:19 -04:00
abraunegg f779881ff9
Check to ensure that file downloaded and is present locally before setting times (Issue #496)
* Check to see if the file was actually downloaded before attempting to set the times on the file.
* If file is not local, download failed
2019-05-13 08:22:15 -04:00
abraunegg 3e35e20cc5
Update sync.d (#493)
* Add an encoding validation check before any path length checks are performed as if the path contains any invalid UTF-8 sequences, the path walk to establish valid path length will fail
2019-05-13 07:52:49 -04:00
abraunegg caec1cb8cb
Implement --sync-root-files when using a sync_list file (Issue #491) (#492)
* Implement --sync-root-files to sync all files in the OneDrive root when using a sync_list file that would normally exclude these files from being synced
2019-05-09 21:18:49 +10:00
abraunegg bac5d6f1a9
Fix dry run reports "Deleting item from one drive" for remotely created file (Issue #489) (#490)
* Fix --dry-run logging output for faking downloading new files
2019-05-09 19:52:39 +10:00
abraunegg af43b77100
Better handling for initialisation errors (Issue #483) (#484)
* Better handle initialisation issues when OneDrive / MS Graph is experiencing problems that generate 401 & 5xx error codes
2019-05-05 21:06:55 +10:00
abraunegg fbad4b4835
Fix 'Local files not deleted' when using bad 'skip_file' entry (#480)
* Add a check for bad 'skip_file' entry that prevents incorrect searching of local changes (mainly deletes) from being synced
2019-04-25 11:00:23 +10:00
abraunegg ea26e4d830
Add logging as to why resume upload failed (Issue #468) (#470)
* Log 'why' the resume upload failed
* Remove the 'resume_upload' as it is invalid & contains bad data
2019-04-15 10:56:11 +10:00
abraunegg c6923cdf29
Update 'resume_upload' handling in the event of bad OneDrive response (Issue #468) (#469)
* Add JSON response checks in the event OneDrive sends malformed data
2019-04-15 08:10:48 +10:00
abraunegg 25d2f7284f
Update 'min_notif_changes' to 'min_notify_changes' (#467)
* Update 'min_notif_changes' to 'min_notify_changes'
2019-04-15 06:28:32 +10:00
abraunegg 521cf33001
Add 'quota' check for valid value (#466)
* If the 'quota' details are not provided when querying the OneDrive account details, we cannot set 'remainingFreeSpace' Add a flag that if this is 0 or negative, ignore validating if there is enough free space to upload a file and just upload blindly
2019-04-13 08:59:03 +10:00
abraunegg a2889098e9
Handle object error response from OneDrive (Issue #464) (#465)
* Add specific check to ensure that variable is of type object
* Add error logging to indicate error response from OneDrive was received
* Update error logging in saveItem to match
* Add a '401 Unauthorized' event handler when querying OneDrive if the file exists
2019-04-13 08:31:54 +10:00
Norbert Preining ea22d8fef5 config options for command line switches (#449)
* config options for command line switches to allow for better config handling in docker containers
2019-04-11 12:26:20 +10:00
abraunegg f12bcfb650
Add debugging for --get-O365-drive-id (#462)
* Add debugging for --get-O365-drive-id
2019-04-10 20:26:21 +10:00
abraunegg 92d2f14f15
Update 'root' item identification handling (#457)
* Add additional check to ensure item root we flag as 'root' is not just name checked as 'root'
2019-04-09 05:05:47 +10:00
abraunegg ea2e4a98bf
Add --upload-only check for sharepoint fix (Issue #452) (#453)
* Add a check for --upload-only use when trying to work around https://github.com/OneDrive/onedrive-api-docs/issues/935
* Update logging and print a warning message that the files are now technically different due to sharepoint bug and using --upload-only
2019-04-06 12:44:51 +11:00
abraunegg 7c2b3e853d
Implement more meaningful 5xx error responses (Issue #445) (#451)
* Issue #445 and https://github.com/OneDrive/onedrive-api-docs/issues/1035 highlight that the current 5xx error messages are too generic and need to be more specific. This patch makes those error messages more specific to the response code from OneDrive API
2019-04-04 17:13:15 +11:00
abraunegg 6a6b8f128f
Issue #432 and #441 combined (#447)
* Re-add original #432 and #441 fixes to master
2019-04-02 05:21:02 +11:00
abraunegg abb82868e4
Roll back to v2.3.1 (#446)
* Roll back to v2.3.1 after bad re-base merge with PR #389
2019-04-02 04:51:25 +11:00
abraunegg f38b13dd00
Resolve file creation loop when working directly in the synced folder with libreoffice (#442)
* Add debug line for flagging to disable upload validation checks
* Handle Microsoft 'enrichment' of certain documents when stored on Sharepoint
* Handle skip_dir checks when nothing to check against (false positive)
* Update default 'skip_file' to include tmp and lock files generated by LibreOffice
* Update code comments & logging output
* Update readme & default config file
* Update database version due to changing defaults of 'skip_file' which will force a rebuild and use of new skip_file default regex
2019-04-02 04:00:22 +11:00
abraunegg 4444b9cd8a
Reduce scanning of local filesystem needlessly every sync in monitor mode (#433)
* Reduce scanning the entire local system in monitor mode for local changes
* Add 'monitor_fullscan_frequency' to set the frequency of performing a full disk scan when in monitor mode
2019-04-02 03:58:56 +11:00
Norbert Preining b7cc540c2c fixes to the merge routine 2019-03-25 10:25:10 +09:00
Norbert Preining a433b44b56 Merge branch 'master' into norbert/config-options 2019-03-25 09:41:27 +09:00
abraunegg 79cc599057
Resolve high CPU usage when performing DB reads (#419)
* Disable automatic indexing as we specifically create the required indexes
* Tell SQLite to store temporary tables in memory. This will speed up many read operations that rely on temporary tables, indices, and views.
* Add links & reasoning behind other PRAGMA settings used
* Add new index specifically for driveId & parentId paring
* To force DB schema & index creation, bump DB schema version
* Update handling of skip_dir and skip_file parsing - should only check if the file is excluded if the parent directory is not
* Add another index for selectByPath database queries
* Add new build option to get more DEBUG symbolic information
* Use boolean values rather than on / off values
* Enable auto_vacuum for entry deletes / database cleanup
2019-03-24 11:12:40 +11:00
abraunegg 002f9b7aec
Prevent use of --synchronize & --monitor together (#431)
* Prevent use of --synchronize & --monitor together
2019-03-23 10:20:27 +11:00
abraunegg f5c3e7643d
Update 'skip_dir' handling to check against OneDrive new downloads (#427)
* Add check for directories to match skip_dir entries for OneDrive objects to download
* Update logging as to why a OneDrive object was skipped
2019-03-22 15:21:59 +11:00
Norbert Preining 8f28daec8a ignore a path containing multiple dirs in skip_dir 2019-03-22 12:05:30 +09:00
abraunegg de98fe8492
Fix JSONValue is not an object crash when a 5xx error is returned when uploading files (#426)
* Fix JSONValue is not an object crash when a 5xx error is returned when uploading files
2019-03-22 10:23:21 +11:00
abraunegg f2e007a1d7
Update skip_dir config handling (#418)
* Original skip_dir handling expected an explicit match to path to match. With this patch, wildcard matching for any directory matching the path entry will be skipped
2019-03-22 05:30:32 +11:00
abraunegg 6b8b51a7cc
Update sync.d (#422)
* Add a check to validate if 'size' is in the JSON response
2019-03-21 10:29:04 +11:00
Norbert Preining 3aff2e8251 move verbose check to first getopt to make it available early on 2019-03-17 13:10:41 +09:00
Norbert Preining ab918dd82d config directory management fixes 2019-03-17 12:41:26 +09:00
Norbert Preining 362bf35688 Merge branch 'master' into norbert/config-options 2019-03-17 12:25:27 +09:00
abraunegg 99c0267c7a
Implement 'skip_dir' config option (Issue #123) (#388)
* Implement config option 'skip_dir'
2019-03-15 06:55:05 +11:00
abraunegg ac7789df14
Update error logging around directory case-insensitive match (#412)
* Update error logging around directory case-insensitive match
2019-03-14 05:44:43 +11:00
abraunegg 4c3b959bf6
Resolve unhandled application crash when invalid auth response is used (Issue #399) (#410)
* Add a http 400 response error handler
* If the response uri generates a 400 error, the JSON response will not contain the access_token. Request to re-authenticate
2019-03-12 11:50:21 +11:00
abraunegg e849eb3de4
Resolve Key not found: nextExpectedRanges (Issue #408) (#409)
* Dont 'assume' that the key value pairs exist. Check if they do before attempting to use them
2019-03-12 11:49:15 +11:00
abraunegg 98624267c5
Implement --dry-run (#337)
* Implement new feature --dry-run
2019-03-11 17:57:47 +11:00
abraunegg 3f08e271af
Update util.d - reduce local FS read overheads (#407)
* Try and read 1 byte of the file rather than 10MB for each 'new' file to be uploaded to validate local file permissions
2019-03-11 17:56:26 +11:00
abraunegg efaaaadce2
Rework function uploadCreateDir (#397)
* Ensure that on query failure, default root and drive id is used
2019-03-08 08:40:29 +11:00
abraunegg ba834368ca
Implement --check-for-nosync to ignore folder when special file present (Issue #163) (#390)
* Implement a capability to ignore a folder when a special file (.nosync) is present
2019-03-03 05:58:36 +11:00
Norbert Preining e5b500a041 remove unnecessary code, cleanup 2019-02-27 08:57:04 +09:00
Norbert Preining 388a3bb102 Merge branch 'master' into norbert/config-options 2019-02-27 08:51:28 +09:00
Norbert Preining 09f328e63f configurable logging intervals in monitor mode (Issue: #378) (#391)
* Configurable interval of logging in monitor mode (Issue: #378)
2019-02-27 07:21:23 +11:00
Norbert Preining b668ecef71 Create new upload session on reinit (Issue: #379) (#392)
* By moving the UploadSession creation from the constructor to the init function we guarantee that a re-initialization also starts a new UploadSession.
2019-02-27 06:49:23 +11:00
Norbert Preining 8cabe38e49 update log.verbose from options 2019-02-25 11:55:32 +09:00
Norbert Preining 8b7d772680 remove work-around from previous versions 2019-02-24 16:58:02 +09:00
Norbert Preining d02be44b9a order getopt call options alphabetically 2019-02-24 16:56:50 +09:00
Norbert Preining d49a598f4b clean up, move help function 2019-02-24 16:33:10 +09:00
Norbert Preining a71b9bf789 Merge branch 'master' into norbert/config-options 2019-02-24 16:27:53 +09:00
abraunegg 7a47df7a38
Implement --skip-dot-files (#386)
* Implement new CLI option --skip-dot-files to skip .files and .folders if option is used
2019-02-24 17:19:45 +11:00
Norbert Preining f2f272a8f8 move more parts of the getopt calls into config module 2019-02-22 22:00:57 +09:00
Norbert Preining a635cab0ad config options: working version 2019-02-22 16:15:10 +09:00
Norbert Preining 25b09775ab more playing around 2019-02-22 10:41:07 +09:00
Norbert Preining 7c9ea56293 some playground 2019-02-22 10:39:16 +09:00
Norbert Preining 18611c833f initial work on various config options for cmd line options 2019-02-22 10:39:16 +09:00
Norbert Preining 0d3b891177 don't annoy with notifs when offline and cannot act on changes (#385)
* Don't annoy with notifs when offline and cannot act on changes
2019-02-21 19:51:15 +11:00
Jack Thomasson 460596dd36 Add smaller footprint Docker container builds using Alpine and Debian Stretch (#369)
* Add additional Docker container builds utilising a smaller OS footprint
* Resolve compiling with LDC on Alpine as musl lacks some standard interfaces
2019-02-17 06:13:19 +11:00
abraunegg 51615bff0b
Rework PR #373 to reduce needless logging in monitor mode (#376)
* Rework PR #373 to reduce needless logging in monitor mode
2019-02-15 07:03:15 +11:00
abraunegg ff822a9ab9
Update handling of incomplete OneDrive JSON responses (#375)
* Re-order handling of response JSON to ensure that 'id' key element is always checked for.
* Print errors when there is an issue with saveItem & articulate why
2019-02-13 05:54:06 +11:00
Norbert Preining 1f955c82be
deal with unavailable dbus server (Issue: #365)
If the dbus server cannot be started or is not available, calling a notification
would result in an exception. During initialization check that we can get the
server information, and disable notifications if this is not possible.

Note: we change dnotify.d from the originally distributed version to include
a check for availability function.
2019-01-30 17:34:07 +09:00
Norbert Preining 1c6fd5df39 notification on incoming changes (#355)
* When notifications are enabled, display the number of OneDrive changes to process if any are found
* Add 'config' option 'min_notif_changes' for minimum number of changes to notify on, default = 5
* Update readme, manual page for new option
2019-01-29 04:54:03 +11:00
Norbert Preining 16da1b4994
treat mv of new file as upload of mv target (Issue: #357) 2019-01-22 15:14:53 +09:00
abraunegg 7532c9d8cc
Update handling of --get-O365-drive-id for multi matching (#354)
* Update handling of --get-O365-drive-id to print out all 'site names' that match the explicit search entry rather than just the last match
* Add webUrl for site to output so that the 'right' site drive_id can be identified
* Update O365 readme with updated output
2019-01-19 13:01:41 +11:00
abraunegg c27ff936fb
Resolve build warning & support CentOS 6.x for installation (Issue #350) (#353)
* Support install on CentOS / RHEL 6.x
* Support uninstall on CentOS / RHEL 6.x
* Add /usr/local/bin/ to search path when starting init.d service
* Fix dmd-2.084.0 deprecation warning: loop index implicitly converted from size_t to int
* Update readme based on CentOS 6 / RHEL 6 additional dependencies
* Resolve warnings about "bashisms" in init.d script (Issue #349) - fixed here as we are updating the init file already, rather than have multiple PR's
2019-01-19 13:01:01 +11:00
abraunegg 83cc2e419b
Add business retention policy handler (Issue #338)
* When OneDrive Business is configured with Retention Policies, attempts to delete a 'non empty' folder results in an an error response. Correctly handle the error response to print a warning message that OneDrive content must be manually deleted. 

**Note:** A future version of this client will handle the removal of 'non empty' folders when Retention Policies are enabled.
2019-01-19 12:59:39 +11:00
abraunegg c91dcc3e49
Add handling for JSON response error when OneDrive API returns a 404 due to API regression (#340)
* Update sync.d to handle OneDrive API Regression & provide details on workaround
2019-01-16 20:14:55 +11:00
abraunegg 1d902a5beb
Handle Item not found exception when unable to query OneDrive 'root' for changes (#336)
* Add a 404 error handler when OneDrive cannot query what changes are available for a particular 'root' folder id
* Add additional verbose debug logging to assist in the future
* Change to not throw an exception when OneDrive cannot query what changes are available for a particular 'root' folder - rather display some meaningful details instead of crashing the application
* As we know the actual 'items.sqlite3' location, display that as the file to remove rather than a 'generic' message as this is more helpful
2019-01-11 05:31:10 +11:00
abraunegg bf43ecda9e
Ensure that remote deletes are handled correctly (#333)
* Fix remote deletes the fix for #323, #324 & #331 introduced a bug where an item when remote deleted, would actually be re-inserted to the database & eventually cause a database assertion
2019-01-07 04:22:09 +11:00
abraunegg b75163245f
Update handling of 'remote' folder designation as 'root' items (Issue #323, #324, #331) (#328)
* Add extra verbose debugging
* Update handling of 'remote' folder designation as 'root' items
2019-01-07 03:02:08 +11:00
abraunegg 1fa7e5f20c
Add extra debugging & http protocol downgrade (Issue #314) (#327)
* Add --force-http-1.1 flag to downgrade any HTTP/2 curl operations to HTTP 1.1 protocol
* Explicitly set all bool items to false at initialisation
* Update --display-config to display sync_list if configured
* Add debug handling to display when sync_list is loaded
* Add debug handling to output the handling of OneDrive changes
2019-01-06 05:43:44 +11:00
abraunegg ddc5d602da
Update sync.d (#329)
* Update HTTP 412 error notifications to better identify where 412 error is occuring
* Add a check for 'id' key on metadata update to prevent 'std.json.JSONException@std/json.d(494): Key not found: id' (Issue #325)
2019-01-06 05:35:55 +11:00
abraunegg 46ef8ed376 Revert "Update handling of HTTP 412 - Precondition Failed errors (#issue 325) (#326)"
This reverts commit 388cc1ded5.
2019-01-05 17:18:28 +11:00
abraunegg 388cc1ded5
Update handling of HTTP 412 - Precondition Failed errors (#issue 325) (#326)
* Update HTTP 412 - Precondition Failed messaging
* Add debug messaging when 5xx errors occur
* Update 5xx message to include
2019-01-05 07:57:10 +11:00
Norbert Preining b9890ae2e5
better help output formatting (Issue #298) 2018-12-28 18:01:50 +09:00
Norbert Preining fcf1ef2e1f
signal handling and database shutdown (#315)
Add a signal handler and shutdown database connection on SIGINT and SIGTERM
to make sure that .waf files are properly incorportated into the sqlite database.
2018-12-28 11:19:20 +09:00
abraunegg 2553366a89
Implement Feature Request: Add status command or switch (Issue #112) (#307)
* Implement Feature Request: Add status command or switch
2018-12-28 12:26:03 +11:00
abraunegg 7a6b507367
Update sync.d (#316)
* Update logic handling of --single-directory to prevent inadvertent local data loss
2018-12-28 11:57:32 +11:00
Norbert Preining 2ec6aa3df6
make sure sqlite checkpointing works by properly finalizing statements (#310)
If an sqlite statement is prepared and reused by using reset again and again, the connection
keeps a lock on the database, and checkpointing cannot ensure that transaction from the
wal file are carried over into the main database.

By preparing the statement every time it is used, the destructor calls finalize and thus
the lock is released.

Possible impacts during high frequency changes via monitor mode etc might arise.
2018-12-26 16:11:06 +09:00
abraunegg 5d388581b1
Resolve 'sync_dir' not read from 'config' file when run in Docker container #306 (#308)
* Fix logic for sync_dir handling on headless systems
* Fix logic where potentially a 'default' ~/OneDrive sync_dir could be set despite 'config' file configured for an alternate
* Add debug handling for sync_dir operations
* Add debug handling for homePath calculation
* Add debug handling for configDirBase calculation
* Reorder main() so that log.vdebug works where required
* Rework configDirName as this had the same issue as syncDir
* Update configDirName & syncDir '~' handling & replacement to be more robust and only replace if '~' is first char in string
* Add additional debug logging if syncDir is created
2018-12-23 11:15:10 +11:00
abraunegg 1060d85118
Resolve JSONException when supplying --get-O365-drive-id option with a string containing spaces (#305)
* JSONException when supplying --get-O365-drive-id option with a string containing spaces
2018-12-21 11:28:16 +11:00
abraunegg 594bfcec54
Fix syncdir option is ignored (#302)
* Explicitly set value for syncdir if the option is passed in via CLI rather than 'config' file
2018-12-20 17:27:34 +11:00
abraunegg dfd3045ce4
Fix exception when missing parameter from usage option (#299)
* Handle the exception generated when an option is used which is expecting an input parameter but none is given
2018-12-20 11:05:32 +11:00
Norbert Preining 025a3b2878
check config file keys for validity (#296)
* check config file keys for validity, use setValue instead of direct access
* Update config.d
  Add 'drive_id' to be initialised, set to an empty string
* exit application if there is a configuration file error
* Issue #293 was caused by a spelling error in the configuration file. 
  If the configuration file has errors, we should not load it or run
  using the application defaults as this may have undesirable consequences
  for users data
* missed returning false on key issue
* Missed this edit of the file
2018-12-20 08:51:21 +09:00
abraunegg 7d522583ef
Implement option --display-config (Issue #100) (#292)
* Implement --display-config to show the application configuration without actually performing a sync or application init
2018-12-20 05:42:28 +11:00
abraunegg 53df30810e check displayName rather than description (#290)
* In testing, 'description' and 'displayName' were the same, but in reality we are checking against the 'displayName' value as this is what we are asking the user to input, thus we need to check against displayName
2018-12-18 13:20:17 +09:00
Norbert Preining 91aaf91aa6 Reinitialize sync engine after three failed trials (#283)
* After extended suspend, or bad connection, the connection to OD might
go stale - thus no network connection to Microsoft OneDrive Service, skipping sync
and this continues ad infinitum. Change the last action to re-initialize the sync engine.
2018-12-13 07:08:18 +11:00
Norbert Preining 6a62406db7 Deal with deleted move targets (Issue: 273) (#278)
if the move target has been deleted before the monitor action completes,
the monitor action throws an exception when stat-ing the target for
mtime. Do not do anything in case the move target has disappeared
2018-12-08 05:02:47 +11:00
Norbert Preining 3608dcc4c2 Add very verbose (debug) mode by double -v -v (#279)
* Add very verbose (debug) mode by double -v -v - currently only used for debugging the inotify events
2018-12-08 05:01:22 +11:00
Norbert Preining 87cd18379d Deal with items that disappear during upload (Issue: #258) (#276)
* Deal with disappearing items during upload (Issue: #258)
2018-12-06 20:28:03 +11:00
Norbert Preining 06aa42f6d1 better log messages, less noise on temporary timeouts (#275)
* better log messages, less noise on temporary timeouts
2018-12-06 18:05:52 +11:00
abraunegg 0562c52492 Handle short lived files (Issue #273) (PR #274)
* Handle short lived files (Issue #273)
* Update README.md
* Add --disable-notifications to readme
2018-12-06 08:50:46 +09:00
Norbert Preining cc6cbf5ac7 Notification support via libnotify (#270)
* add external sources for (d)notify with README and license statements
* add new logAndNotify function, make building a compile time option
* use logAndNotify and main.d, make timeout message silent
* update documentation for notification support
* add command line switch --disable-notifications
* add build-deps for libnotify in README.md
2018-12-06 06:19:00 +11:00
Norbert Preining b10e641fe9 allow starting offline in monitor mode (#266)
* SyncEngine: allow for multiple calls to init by saving the state
* Factor out syncengine initialization code so that it can be reused
* Don't exit in monitor when started offline
* Always call initSyncEngine during regular syncs, this will call the SyncEngine init routine which caches the state, thus a quasi no-op.
* Add forgotten http.shutdown
2018-12-04 11:15:44 +11:00
abraunegg 29808c905c
Implement --get-O365-drive-id to get correct SharePoint Shared Library (Issue #248) (#260)
* Implement --get-O365-drive-id to return the correct drive_id of a SharePoint Shared Library to use for syncing that repository
2018-12-04 10:59:23 +11:00
abraunegg cdb11326b9
Fix unreachable statements (#268)
* Add warning flag to compiler
* Fix unreachable statements

**Credit:** Zamir SUN <sztsian@gmail.com>
2018-12-04 06:29:18 +11:00
Norbert Preining 9817104ca1 continue in monitor mode when sync timed out (#265)
* update handling of connection timeouts in monitor mode & allow application continue rather than exit
2018-12-03 13:41:31 +11:00
Norbert Preining c24e4b0b1e adjust timeout values for libcurl (issue #256) (#261)
This change adjusts the two core timeout parameters of libcurl operation
- dataTimeout: changed from 3600sec to 300sec
  this timeout controls the max time when there is no data incoming
  (actually below CURLOPT_LOW_SPEED_LIMIT)
- operationTimeout: added 3600sec
  this timeout controls the maximally allowed connection timeout
2018-12-02 11:30:50 +11:00
Norbert Preining 0d05274f32 Fix renaming of files sync issues (#252)
* issue #249 do not safeRename the target if it is in sync
* issue #249 only remove actual path if the associated ids agree
2018-11-29 21:31:44 +11:00
Norbert Preining 11138602ed gracefully handle connection errors in monitor mode (#253)
* gracefully handle connection errors, resolve issue #234
2018-11-29 20:48:24 +11:00
abraunegg a26a69ce9f
Change logging to a separate logfile is no longer the default (#239)
* Change '--download' to '--download-only' to align with '--upload-only'
* Enable logging to a separate file only if the '--enable-logging' flag is passed through at client run time
* Implement configuration option for logfile location, if logging is enabled
2018-11-24 07:13:16 +11:00
abraunegg c5ee62efd8
Sync with shared folders/drives for onedrive business (#206)
* Refactor PR104 for latest code base to enable client use with SharePoint libraries
* Implement '--disable-upload-validation' as SharePoint modifies files when uploaded
* Enable '--disable-upload-validation' by default if account type is documentLibrary - as most likely this is a SharePoint repository
2018-11-24 06:26:30 +11:00
abraunegg 23e79d39e1 Update sync.d
* Update exit codes on sync.init() to -1
2018-11-22 07:11:14 +11:00
abraunegg cbd3ecbf71
Resolve unable to create folders on shared OneDrive accounts (Issue #217) (#244)
* Update logic to use remote item details for folder creation
* Backport sync.d changes from PR #246 to this PR before merge
2018-11-22 07:03:04 +11:00
abraunegg fc162b94e2
Resolve database assertion failure due to authentication HTTP/1.1 400 Bad Request (#246)
* Enhance initialisation error handling to catch 4xx errors
2018-11-21 18:54:08 +11:00
abraunegg eaedfac34a
Update onedrive.d for additional debug logging (#238)
* In case the user does not use the --verbose tag, if we are doing --https-debug we want this printed to the console
2018-11-18 07:05:01 +11:00
abraunegg e70722862c
update files for 2.1.6 release (#235)
* update files for 2.1.6 release
2018-11-15 06:43:58 +11:00
abraunegg f785396643
Update HTTP/2 handling for session uploads (#233)
* Remove HTTP 1.1 downgrade for session uploads
* Handle HTTP/2 0 (zero) response code for successful session data upload
* Add debugging for actual server response, not curl interpreted response when using --debug-https
2018-11-15 06:08:55 +11:00
abraunegg 8a98bf3e30
Add handling for HTTP Code 302 generated by HTTP/2 calls (#229)
* Update initial Curl 7.62.0 fix with a better solution which handles the redirect's given by HTTP/2 connections (credit @Popa21)
* Use HTTP/1.1 for session uploads otherwise the response when using HTTP/2 generates a 'JSONValue is not an object' error
2018-11-12 06:01:57 +11:00
abraunegg 86ea576144
Handle HTTP request returned status code 412 (Precondition Failed) for session uploads (#227)
* Handle HTTP request returned status code 412 (Precondition Failed) for session uploads to OneDrive Personal Accounts
* Fix Failed to remove file /root/.config/onedrive/resume_upload: No such file or directory if there is a session upload error and the resume file does not get created
* Handle response codes when using 2 different systems using --upload-only but the same OneDrive account and uploading the same filename to the same location
2018-11-11 11:15:48 +11:00