forked from CenterForOpenScience/waterbutler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github: enable v1 ops for files larger than 1Mb
The github provider's `validate_v1_path` method was using the Github `contents` API endpoint to retrieve metadata about the path, so that it could determine whether a file or folder at that path already exists and is of the correct type. Unfortunately, the `contents` endpoint also returns the file contents along with the metadata. Because of this, GitHub will refuse to respond if the requested file is bigger than 1Mb. `validate_v1_path` has been updated to request a recursive tree listing, which it can then search through for the given path. Fixes: [#OSF-5866]
- Loading branch information
Showing
3 changed files
with
68 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from waterbutler.core.exceptions import ProviderError | ||
|
||
|
||
class GitHubUnsupportedRepoError(ProviderError): | ||
def __init__(self): | ||
message = ('Some folder operations on large GitHub repositories cannot be supported without' | ||
' data loss. To carry out this operation, please perform it in a local git' | ||
' repository, then push to the target repository on GitHub.') | ||
super()._init(message, code=501) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters