Skip to content

Commit

Permalink
šŸ› Fix Alchemy#download(path) breaking when no name is found to storā€¦
Browse files Browse the repository at this point in the history
ā€¦e file as
  • Loading branch information
skerit committed Dec 27, 2024
1 parent 0dd6c5f commit 8bea114
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Fix `Conduit#parseRequest()` forgetting GET query parameters when overriding respone url
* Make `Model#aggregate(pipeline)` work again
* Fix `Alchemy#download(path)` breaking when no name is found to store file as

## 1.4.0-alpha.8 (2024-11-28)

Expand Down
8 changes: 6 additions & 2 deletions lib/core/alchemy_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ function convertDataUriToFile(data_uri) {
*
* @author Jelle De Loecker <jelle@elevenways.be>
* @since 1.3.0
* @version 1.3.0
* @version 1.4.0
*
* @param {string} url
*
Expand Down Expand Up @@ -1226,10 +1226,14 @@ Alchemy.setMethod(function download(url, options) {
}

if (!name) {
name = alchemy.ObjectId();
name = alchemy.ObjectId() + '';
}
}

if (!name || typeof name != 'string') {
name = alchemy.ObjectId() + '';
}

if (name.indexOf('/') > -1) {
name = name.replaceAll('/', '-');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alchemymvc",
"description": "MVC framework for Node.js",
"version": "1.4.0-alpha.8",
"version": "1.4.0-alpha.9",
"author": "Jelle De Loecker <jelle@elevenways.be>",
"keywords": [
"alchemy",
Expand Down

0 comments on commit 8bea114

Please sign in to comment.