-
Notifications
You must be signed in to change notification settings - Fork 322
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
added download_folder method #404
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -1024,6 +1024,18 @@ function download_zip_url(options = {}) { | |
})); | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't we drop the need of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not merged yet |
||
* Creates and downloads a URL that when invokes creates an archive of a folder | ||
*/ | ||
function download_folder(folder_path, options = {}) { | ||
options.resource_type = options.resource_type || "all"; | ||
options.prefixes = folder_path; | ||
strausr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let cloudinary_params = exports.sign_request(exports.archive_params(merge(options, { | ||
mode: "download", | ||
})), options); | ||
return exports.api_url("generate_archive", options) + "?" + hashToQuery(cloudinary_params); | ||
} | ||
|
||
/** | ||
* Render the key/value pair as an HTML tag attribute | ||
* @private | ||
|
@@ -1198,6 +1210,7 @@ function archive_params(options = {}) { | |
transformations: utils.build_eager(options.transformations), | ||
type: options.type, | ||
use_original_filename: exports.as_safe_bool(options.use_original_filename), | ||
folder_path: options.folder_path, | ||
}; | ||
} | ||
|
||
|
@@ -1382,6 +1395,7 @@ exports.present = present; | |
exports.only = pickOnlyExistingValues; // for backwards compatibility | ||
exports.pickOnlyExistingValues = pickOnlyExistingValues; | ||
exports.jsonArrayParam = jsonArrayParam; | ||
exports.download_folder = download_folder; | ||
// was exported before, so kept for backwards compatibility | ||
exports.DEFAULT_POSTER_OPTIONS = DEFAULT_POSTER_OPTIONS; | ||
exports.DEFAULT_VIDEO_SOURCE_TYPES = DEFAULT_VIDEO_SOURCE_TYPES; | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How this works? the signature include the
mode='download'
but the options sent to the api does notThere 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.
its part of the cloudinary_params sent in the hashToQuery(cloudinary_params);
Its the same concept needed in download_archive_url-
cloudinary_npm/lib/utils/index.js
Line 1009 in b1e23fc
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.
Still don't understand how this works
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.
What do you mean? both the signature and the api call include the
mode=download param
.The
sign_request
method returns the signed params with themode
param included (after signing).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.
What am I missing?
There are
options
which are sent to the API and when building the signature, we mergeoptions
withmode=download
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.
After discussion - all params are sent on the query string and the options sent to the
api_url
are for general config and not params to the specific api call