-
-
Notifications
You must be signed in to change notification settings - Fork 598
Add ability to check that a file exists in repo branch/commit #166
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
Conversation
Using only HEAD method to avoid downloading file contents when the file does exist
@@ -172,7 +194,7 @@ protected function delete($path, array $parameters = array(), $requestHeaders = | |||
/** | |||
* Create a JSON encoded version of an array of parameters. | |||
* | |||
* @param array $parameters Request parameters | |||
* @param array $parameters Request parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nop
Thank you ! The idea is pretty :) . Can you add a part of doc for it ? |
Erf, sorry, comes from my autoformat settings... Gonna fix that & add the doc |
All right, doc is done for the Contents API (except the archive endpoint which I never user). Let me know if there are changes to be made. |
} | ||
} | ||
catch (TwoFactorAuthenticationRequiredException $ex) { | ||
throw $ex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 1 line above with } catch
, same for others
@aztech-dev perfect! |
Add ability to check that a file exists in repo branch/commit
Current Contents API requires to download the file (even with the "show" method, file content is returned up to 1Mb in size) just to check if it exists remotely.
Proposed changes adds a head(...) helper method to AbstractApi and leverages it to make a HEAD call to the "Get contents" endpoint of the API instead of a GET to avoid downloading file content.