Commit graph

332 commits

Author SHA1 Message Date
abraunegg 83c28ba3b6
Fix: Multiple versions of file shown on website after single upload (Issue #2) (#40)
* Resolve multiple versions of file shown on website after single upload - however Issue #23 & OneDrive API bug (https://github.com/OneDrive/onedrive-api-docs/issues/877) will still create 2 file versions on OneDrive Business. The work around is to disable file versions until #877 is resolved.
2018-07-03 07:24:57 +10:00
abraunegg 5e48ba96ac
Fix: Error when trying to upload a file with weird non printable characters present (Issue #35) (#41)
* Implement an invalid whitespace filename check which currently checks for a 'new line' whitespace entry in a filename. Regex can be expanded if other files with similar characteristics are found.
2018-07-02 19:40:54 +10:00
abraunegg 17e5138b5a
Resolve sync issues with Shared Folders & Personal OneDrive Accounts (#26)
* Resolve Shared Folders not syncing (OneDrive Personal)
* Resolve 'Key not found: fileSystemInfo' when then item is a remote item (OneDrive Personal)
* Resolve where file names are being truncated by 5 characters with each sync (OneDrive Business)
* remove extra // not required
* Remove commented out code to avoid confusion
2018-06-17 12:02:58 +10:00
abraunegg d6b4930d0a Revert "Resolve: Key not found: fileSystemInfo when syncing shared folders"
This reverts commit e7267e597b.
2018-06-13 16:35:52 +10:00
abraunegg 2fe63f581d Revert "Encode syncFolderName for easier 'canFind' processing"
This reverts commit 943fcc032b.
2018-06-13 06:46:56 +10:00
abraunegg 943fcc032b Encode syncFolderName for easier 'canFind' processing
* Resolve "Remote change discarded - not in --single-directory scope" when syncing Shared Folder sub directories
2018-06-10 11:10:49 +10:00
abraunegg e7267e597b Resolve: Key not found: fileSystemInfo when syncing shared folders
* Resolve #11 where shared folders were unable to be sync'd due to fileSystemInfo data being within the remoteItem object
* Initial work on resolving #2, but fix not validated or complete
2018-06-09 21:43:39 +10:00
abraunegg dc4bfb62ff
Update sync.d
Update comment - 256 -> 400
2018-05-25 14:17:28 +10:00
abraunegg 3381511e19 Update path and naming limitations
* Resolve https://github.com/abraunegg/onedrive/issues/6
* Update OneDrive Business path length to 400 characters
* Update allowed characters for path and file names
2018-05-25 14:12:39 +10:00
abraunegg 18ee4649e0 Resolve #356 by adding additional check for 409 response
* Add an additional check for 409 (Conflict) being returned when creating directories even when the directory is only attempted to be created when it cannot be found.
2018-05-23 03:46:13 +10:00
abraunegg 0b1ca6dbfd Fix incorrect id tag
* Fix incorrect id tage when checking database if item exists
2018-05-15 07:15:54 +10:00
abraunegg 8b0e9513e3 Resolve another itemdb.d(307): Assertion
* Clean up --single-directory logging as we should not be spilling out the actual item details
* Fix some spelling errors
* Fix another core.exception.AssertError@src/itemdb.d(307): Assertion failure when attempting to compute the path
* Fix logging when items are being filtered out as non relevant
* Add upload validation that file uploaded equals the size of the file locally as this is a contributing factor to 412 errors
2018-05-15 06:59:17 +10:00
abraunegg 9520fe7716 Resolve itemdb.d(295): Assertion failure
* Resolve core.exception.AssertError@src/itemdb.d(295): Assertion failure when performing a --single-directory sync
2018-05-09 16:39:23 +10:00
abraunegg 41976ed216 Update long path handling
* Update long path handling to account for differences between OneDrive Personal and OneDrive Business Accounts
* Update logging to be cleaner on fragment uploads
2018-05-09 06:47:03 +10:00
abraunegg accb62bdeb Update logging of 500 & 504 errors
* Update logging of 500 & 504 errors. For 504 errors this was 'breaking the formatting of the log line. For 500 errors - this needs to be logged regardless of verbosity.
2018-05-07 05:37:47 +10:00
abraunegg 0c4def83f8 Resolve 500 & 504 HTTP Status Codes
* When completing some operations on OneDrive, a 504 error can be returned when Microsoft Graph times out when communicating with internal resources. Rather than failing, handle the 504 and retry the request.
* When performing numerous changes via OneDrive online, Microsoft Graph has an issue in interpreting the the response, thus generates a 500 internal server error. As this is something we cannot fix, handle the 500 error by gracefully exiting.
2018-05-05 17:00:50 +10:00
abraunegg 0b5dc66507 Rework OneDrive generating a 412 'Precondition Failed' Error
* Rework the 412 fix so that the OneDrive client gracefully handles the
error & retries the metadata update without the eTag/cTag causing the
issue.
* Fix the double logging to console of 'upload' and 'download' items
2018-05-03 16:21:53 +10:00
abraunegg ccd4dfbaf7 Resolve #341 '--single-directory' edge case
* Resolve where '--single-directory' is used to sync a single directory,
but a file / folder is 'moved' on OneDrive to outside the scope of the
focus of the '--single-directory' path. Before this change, the file
would remain in the local path (original location) whilst it would
reside in the new OneDrive path. This patch looks for this mis match and
deletes the local file / folder to reflect it is no longer in the same
OneDrive path.
2018-04-29 12:39:27 +10:00
abraunegg 6fe06d03ac Resolve 'Directory not empty' issues on bulk deletes
* In some cases OneDrive does not send all delete changes or changes are
out of order. When deleting local files, this can lead to a 'Directory
not empty' error. This change adds to check for any remaining children
of a directory that is to be deleted and delete them before
2018-04-26 09:45:18 +10:00
abraunegg dff245d29b Resolve 'view.delta can only be called on the root'
* Resolve the error 'view.delta can only be called on the root' when
using OneDrive Business Account & --single-directory switch
* Change checkDatabaseForOneDriveRoot so that it is performed at init()
and not needed to be called a number of other times throughout the code
- leads to less HTTPS calls being made
* Cleanup comments that are no longer relevant due to
checkDatabaseForOneDriveRoot being run at init()
2018-04-23 10:58:47 +10:00
abraunegg 63f991a64e Reduce HTTPS calls for rootId & driveId by using init() set values
* Rather than make repeated HTTPS calls for the OneDrive rootId &
driveId, reuse the rootId & driveId as set via init() where possible
2018-04-21 16:30:35 +10:00
abraunegg 7a394a065f Resolve issue #73 - OneDrive Error 507 Insufficient Storage Exception
* Resolve https://github.com/skilion/onedrive/issues/73 by by tracking
the change in available free disk space when uploading a new file to
OneDrive
2018-04-21 14:54:50 +10:00
abraunegg 82ef982240 Configure at sync.init() global variables for driveId, rootId, accountType & space available
* Configure at sync.init() global variables for driveId, rootId,
accountType & space available
2018-04-21 14:32:39 +10:00
abraunegg 134c14e459 Resolve 'Key not found: lastModifiedDateTime' (OneDrive API change)
* Original patch (77c0cdbe24) whilst it
resolved the issue of a OneDrive API change, when a file was deleted on
OneDrive, it was not actually deleted on the local file system. This
patch re-implements the fix for 'Key not found: lastModifiedDateTime' by
taking into account the deleted state of the item and correctly removes
the local file that is now in the deleted state.
2018-04-21 14:03:02 +10:00
abraunegg 751d790631 Revert "Resolve 'Key not found: lastModifiedDateTime'"
This reverts commit 77c0cdbe24.
2018-04-21 07:32:31 +10:00
abraunegg 076b180e63 Revert "Manually revert lastModifiedDateTime"
This reverts commit 4a8456fa96.
2018-04-21 07:32:18 +10:00
abraunegg 4a8456fa96 Manually revert lastModifiedDateTime
* Manually revert lastModifiedDateTime
2018-04-21 07:24:19 +10:00
abraunegg 8a059dc0e1 Revert "Switch to using list_children for an item id's children"
This reverts commit fedaedacd7.
2018-04-21 07:19:04 +10:00
abraunegg 3d224d0595 Revert "Resolve issue #73 - 507 Insufficiente Storage Exception"
This reverts commit 648c1ef094.
2018-04-21 07:19:00 +10:00
abraunegg 894bdcde08 Revert "Fix itemdb.d assertion"
This reverts commit 66d00c5ec9.
2018-04-21 07:18:53 +10:00
abraunegg 095aa64cd6 Revert "Revert 77c0cdbe24 temporarily"
This reverts commit be03fa48df.
2018-04-21 07:18:46 +10:00
abraunegg be03fa48df Revert 77c0cdbe24 temporarily
* The fix in 77c0cdbe24 whilst resolves
'Key not found: lastModifiedDateTime' introduces a bug where files
deleted by onedrive, are not deleted locally. Reverting the change to
implement a fuller fix for 'Key not found: lastModifiedDateTime'.
2018-04-21 07:09:18 +10:00
abraunegg 66d00c5ec9 Fix itemdb.d assertion
* Fix core.exception.AssertError@src/itemdb.d(293): Assertion failure
introduced after onedrive.viewChildrenById(driveId, id) change
(fedaedacd7)
2018-04-20 18:41:49 +10:00
abraunegg 648c1ef094 Resolve issue #73 - 507 Insufficiente Storage Exception
* Resove https://github.com/skilion/onedrive/issues/73 by implementing a
check, initialised on init() to track the space used by uploads vs space
available
2018-04-19 16:14:42 +10:00
abraunegg fedaedacd7 Switch to using list_children for an item id's children
* Change how onedrive get's the children from a particular item id.
Previously view.delta was used to return the children, however
view.delta is not implemented on children when using OneDrive Business
accounts. By using list_children, we can get the children from any id
correctly when using either a 'personal' or 'business' account
2018-04-19 14:31:35 +10:00
abraunegg 77c0cdbe24 Resolve 'Key not found: lastModifiedDateTime'
* Fix 'Key not found: lastModifiedDateTime'
* Handling of Tombstoned items in the database
* Add for debugging purposes the rootID, driveID and Account Type
* Code cleanup - remove old commented out debugging items that are not
needed
2018-04-18 06:28:08 +10:00
abraunegg 835806f0eb Update "hidden" directory & skip_file handling
* Partial rollback of 570d42269e to
original logic behind isNameExcluded()
* Removed .* from default skip_file configuration
2018-04-16 21:39:45 +10:00
abraunegg 0febd67bd3 Add Microsoft naming conventions and namespace validation for items that will be uploaded
* Add Pull #104 (@JunpeiAnzai) to ensure that uploaded files conform to
Windows naming conventions and namespaces. Refer to
https://msdn.microsoft.com/en-us/library/aa365247 for further details
regarding Windows naming conventions and namespaces.
2018-04-13 11:20:38 +10:00
abraunegg 7eb11f0b44 Log why we are skipping a large file for upload
Log the reason why a file is not being uploaded (missed this in fec7654)
2018-04-12 08:44:52 +10:00
abraunegg fec7654118 Resolve Issues #121, #294, #329
Resolve onedrive crash when uploading files that exceed the allowed
OneDrive individual file limit
2018-04-12 07:31:42 +10:00
abraunegg 570d42269e Fix onedrive not syncing "hidden" directories
* Fix the handling of hidden filenames & directories (.hello, .git etc)
so that these are uploaded / downloaded without issue.
* Add verbose logging for uploaded files as to why they were skipped
2018-04-11 13:02:06 +10:00
abraunegg 5e0e763317 Change logging of upload, download and deletion activities
Prior to this change logging of upload, download and deletion activities
were only written to the log file when using the --verbose flag, however
they would be written to console / syslog. This corrects that behaviour.
2018-04-10 20:03:28 +10:00
abraunegg dd73ae3c4b OneDrive Client Changes
* Fix 4xx errors including (412 pre-condition)
* Add Logging - log to a file (/var/log/onedrive/onedrive.log)
* Add http(s) debugging as a flag
* Add dont sync when just blindly running the application
* Add individual folder sync - ie ~/OneDrive/blah/ vs. syncing
everything in ~/OneDrive/
* Add sync from local directory first rather than download first then
upload
* Add upload long path check (430 character limitation)
2018-03-14 15:43:40 +11:00
skilion 008a5756b3 Fix crash when the delta link is expired 2018-02-18 18:02:38 +01:00
skilion c7e09304a6 fix for https://github.com/skilion/onedrive/issues/269 2018-01-06 21:59:05 +01:00
skilion abad626b3d ensures that the parentId of the root is null 2018-01-06 19:27:27 +01:00
skilion bb3121e10d fix for https://github.com/skilion/onedrive/issues/269 2018-01-06 17:50:36 +01:00
skilion d7f6674f60 removed redundant key parentDriveId 2018-01-02 15:05:32 +01:00
skilion 4ebc4a8544 handle move and delete of remote folders in monitor mode 2018-01-02 13:41:56 +01:00
skilion 9bedec0d7c handle moving items between drives 2018-01-01 18:38:08 +01:00
skilion c54d1927e9 do not throw in makeItem 2018-01-01 16:20:28 +01:00
skilion 80cfdf62cf handle the case of deleting a remote folder locally 2017-12-31 16:56:56 +01:00
skilion fba3ed999e handle large uploads with parent id 2017-12-31 16:11:02 +01:00
skilion c8d5e03be8 upload files new with parent id 2017-12-31 13:47:18 +01:00
skilion 6907daa5e8 create dir with parent id 2017-12-31 13:18:11 +01:00
skilion 95c952fe62 handle deleting remote folders 2017-12-31 12:44:41 +01:00
skilion b7adc4d0cc WIP on remote folders 2017-12-31 02:30:31 +01:00
skilion b250214577 fix path handling of direct children of the root 2017-12-29 16:51:08 +01:00
skilion dd3e1b2861 fix wrong parameters in call 2017-12-29 12:24:26 +01:00
skilion 48559c592d fix handling root of remote item 2017-12-28 19:58:31 +01:00
skilion 35ce743b39 removed exception chaining 2017-12-28 15:03:15 +01:00
skilion 789ec85e0c partial remote items support 2017-12-27 15:13:28 +01:00
skilion 22db459ac4 fixed bug where remotely deleted and recreated directories would make the application crash 2017-08-01 19:20:02 +02:00
skilion 849dd36276 check if the item is in the db before executing operations on it 2017-07-02 15:38:21 +02:00
lanhin 8f5f54f6a1 Merge branch 'master' of github.com:skilion/onedrive 2017-06-22 22:25:04 +08:00
skilion a61abc4e15 fix issue #202 2017-06-20 22:01:57 +02:00
skilion 974be0884b fixed bug where an item is incorrectly assumed to be a file 2017-06-15 15:17:47 +02:00
skilion 126f2719b8 hack for onedrive biz 2017-06-15 14:19:23 +02:00
skilion 3529a4f78b make makeItem() more resiliant 2017-06-15 13:45:14 +02:00
skilion b703a824c7 compute path before performing selective sync 2017-06-15 12:59:33 +02:00
skilion 65bb14ad37 WIP for remote items support 2017-06-14 22:49:00 +02:00
skilion 35f81b2115 itemdb support for remote items 2017-06-14 15:50:02 +02:00
skilion c5a9b8b480 fix bug where remote items are wrongly identified as deleted 2017-06-12 17:54:33 +02:00
skilion b5cbaa13cc cleaned comments 2017-05-28 23:15:03 +02:00
skilion 809ccde562 workaround for old OneDrive files 2017-05-28 22:45:09 +02:00
skilion 44fc36fd8d support for SHA1 and QuickXor hash algorithms 2017-05-28 22:13:19 +02:00
skilion 691862b18f implement the recommended way to enumerate changes 2017-05-28 20:54:57 +02:00
lanhin 79139600ac Merge branch 'master' of github.com:skilion/onedrive
This may fix some up load problems.
2017-04-24 13:45:52 +08:00
skilion 97a9d53914 refactored selective sync code
fixed bug in selective sync
2017-03-24 22:31:56 +01:00
skilion 0d69ed805d wip for OneDrive Biz 2017-03-21 18:11:32 +01:00
skilion 1c7b726994 fix different time resolution when comparing 2017-03-21 18:11:32 +01:00
skilion 79ed0a7883 fix different time resolution when comparing 2017-03-12 17:17:38 +01:00
skilion 2c1c168fab fix root dir skipped when searching for new files 2017-03-12 16:35:47 +01:00
skilion 9dd944286f new feature selective sync
removed system wide config file
hardcoded sane default config
updated README
2017-03-12 16:11:51 +01:00
skilion 957b034805 exit early if the item is to be deleted 2017-03-11 14:21:00 +01:00
skilion 1260fcfcc1 fix addressing root by path 2017-03-11 13:34:07 +01:00
skilion a3b25c45f5 catch CurlTimeoutException 2017-03-11 12:07:21 +01:00
skilion 1beadf2577 switch to Microsoft Graph API 2017-03-11 11:44:53 +01:00
skilion 203062fc6b added missing item fields in saveItem() 2016-12-29 00:36:42 +01:00
skilion 3a10f0f4b5 fixed bug that allowed files marked for deletion to be keeped 2016-12-25 23:34:35 +01:00
skilion bbbfeb68f3 fix condition in applyDifferences loop 2016-12-25 20:19:54 +01:00
skilion c9016845c3 removed time comparison hack 2016-12-25 17:40:43 +01:00
skilion 9ad9394b98 better handle the case when cTag is null 2016-12-25 17:40:43 +01:00
skilion e33f566ecf bug fix 2016-12-14 19:53:25 +01:00
skilion 7257c4c9bf do not throw on expired status token 2016-12-14 15:17:20 +01:00
lanhin 7c112304b5 Bug fixed: 1. Replace mkdirRecurse with mkdir to deal nested directory;2. Before download an item, check if its dirName exists, if not, build it. 2016-11-23 23:10:37 +08:00
Jumpei Anzai 9209a649d7 avoid syncing broken symlink 2016-08-22 17:29:43 +09:00
skilion 738536736a Refactoring
- unified configs
- logging module
- new cmd line option to change the config dir
2016-08-04 23:43:10 +02:00
skilion 0efc2fe382 use view.delta instead of view.changes
removed dependency on client_secret
2016-06-27 19:23:14 +02:00
Sergey Astanin b824f87e7e fix #24: crash on sync if cTag is missing
According to https://dev.onedrive.com/resources/item.htm
cTag property is not returned if the Item is a folder.
2016-02-03 15:29:30 +01:00
skilion c2b0b7f733 intercept curl exceptions 2015-12-29 19:38:15 +01:00
skilion 789bdf8390 ignore 404 errors on delete 2015-10-04 16:27:02 +02:00
skilion 9da9b7240d better way to check if a JSONValue has a member 2015-10-03 10:45:43 +02:00
skilion 2acd00209f rename the local item if it is unsynced and there is a new version of it 2015-09-30 15:53:49 +02:00
skilion 9a50174c08 missing parameters were making uploads fail 2015-09-30 15:14:39 +02:00
skilion 10cfa83d39 fixed bug which caused dirs to not get deleted 2015-09-28 13:42:58 +02:00
skilion 9b80d99ad4 support for files bigger than 100 MB and resumable uploads 2015-09-28 13:25:25 +02:00
skilion f7e4b2f1e3 fixed acces to json nested objects 2015-09-22 16:14:16 +02:00
skilion 7cfa936db8 changed how config files works 2015-09-22 14:48:18 +02:00
skilion 1c21474301 more error handling 2015-09-22 11:52:28 +02:00
skilion c74282879b fix Precondition Failed after upload 2015-09-21 17:23:12 +02:00
skilion 7ea7c0f9cd case insensitive patterns 2015-09-21 13:04:05 +02:00
skilion d2ec6c688f better exception management 2015-09-20 21:21:51 +02:00
skilion 30504d7034 better path handling 2015-09-20 19:07:16 +02:00
skilion 2d50e43674 removed path dependency in Item 2015-09-19 15:38:43 +02:00
skilion 5c6ed227a7 assert on item select 2015-09-19 14:14:51 +02:00
skilion 59d7c0c311 use wildcards instead of regex 2015-09-19 09:45:45 +02:00
skilion 7126c4fefc implemented filter in sync 2015-09-18 21:42:27 +02:00
skilion 9aa1f221c7 skip filtered files in applyDiifferences 2015-09-17 17:34:58 +02:00
skilion 35c290c4a0 working monitor 2015-09-17 16:28:24 +02:00
skilion 4d230a394c finalizing 2015-09-17 00:16:23 +02:00
skilion f887b29061 sync root folder 2015-09-16 10:29:20 +02:00
skilion 2d4cf32be5 refactoring 2015-09-14 23:56:14 +02:00
skilion 424e77e4b5 do not care about directory mtime 2015-09-14 12:57:47 +02:00
skilion 0f21508cfe removed redundant column 'path' in the db 2015-09-14 11:56:40 +02:00
skilion 54e60d4528 real time changes 2015-09-11 18:33:22 +02:00
skilion 504b9d041a fix error where JSONValue become an array instead of a string 2015-09-10 23:04:15 +02:00
skilion 2de650d2be working uploadDifferences 2015-09-08 18:25:41 +02:00
skilion ac4584f795 half working uploadDifference 2015-09-06 22:42:44 +02:00
skilion 3357a013f7 uploadDifferences skeleton 2015-09-04 21:00:22 +02:00
skilion e2ad29744a fix missing catch 2015-09-01 21:17:09 +02:00
skilion 00d53f648e first commit 2015-09-01 20:47:44 +02:00