Skip to content

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

Merged
merged 5 commits into from Aug 1, 2014
Merged

Add ability to check that a file exists in repo branch/commit #166

merged 5 commits into from Aug 1, 2014

Conversation

fabre-thibaud
Copy link

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.

Thibaud Fabre added 2 commits July 31, 2014 14:22
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nop

@Nek-
Copy link
Contributor

Nek- commented Jul 31, 2014

Thank you !

The idea is pretty :) . Can you add a part of doc for it ?

@fabre-thibaud
Copy link
Author

Erf, sorry, comes from my autoformat settings... Gonna fix that & add the doc

@fabre-thibaud
Copy link
Author

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;
Copy link
Contributor

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

@cursedcoder
Copy link
Contributor

@aztech-dev perfect!

cursedcoder added a commit that referenced this pull request Aug 1, 2014
Add ability to check that a file exists in repo branch/commit
@cursedcoder cursedcoder merged commit e66b635 into KnpLabs:master Aug 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants