diff --git a/dist/immich.js b/dist/immich.js index 084b3b0..259d24c 100644 --- a/dist/immich.js +++ b/dist/immich.js @@ -58,9 +58,9 @@ class Immich { switch (asset.type) { case types_1.AssetType.image: size = size === types_1.ImageSize.thumbnail ? types_1.ImageSize.thumbnail : types_1.ImageSize.original; - return this.request('/assets/' + asset.id + '/' + size); + return this.request('/assets/' + encodeURIComponent(asset.id) + '/' + size); case types_1.AssetType.video: - return this.request('/assets/' + asset.id + '/video/playback'); + return this.request('/assets/' + encodeURIComponent(asset.id) + '/video/playback'); } }); } @@ -100,4 +100,4 @@ class Immich { } const immich = new Immich(); exports.default = immich; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1taWNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ltbWljaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxtQ0FBaUU7QUFDakUsMERBQXlCO0FBRXpCLE1BQU0sTUFBTTtJQUNWOzs7T0FHRztJQUNHLE9BQU8sQ0FBRSxRQUFnQjs7WUFDN0IsTUFBTSxHQUFHLEdBQUcsTUFBTSxLQUFLLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLEdBQUcsTUFBTSxHQUFHLFFBQVEsRUFBRTtnQkFDbEUsT0FBTyxFQUFFO29CQUNQLFdBQVcsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sSUFBSSxFQUFFO2lCQUN2QzthQUNGLENBQUMsQ0FBQTtZQUNGLElBQUksR0FBRyxDQUFDLE1BQU0sS0FBSyxHQUFHLEVBQUUsQ0FBQztnQkFDdkIsTUFBTSxXQUFXLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxDQUFBO2dCQUN6RCxJQUFJLFdBQVcsQ0FBQyxRQUFRLENBQUMsa0JBQWtCLENBQUM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zZXQpXG4gICAgcmV0dXJuIGFzc2V0QnVmZmVyLmhlYWRlcnMuZ2V0KCdDb250ZW50LVR5cGUnKVxuICB9XG5cbiAgLyoqXG4gICAqIFJldHVybiB0aGUgaW1hZ2UgZGF0YSBVUkwgZm9yIGEgcGhvdG9cbiAgICovXG4gIHBob3RvVXJsIChrZXk6IHN0cmluZywgaWQ6IHN0cmluZywgc2l6ZT86IEltYWdlU2l6ZSkge1xuICAgIHJldHVybiBgL3Bob3RvLyR7a2V5fS8ke2lkfWAgKyAoc2l6ZSA/IGA/c2l6ZT0ke3NpemV9YCA6ICcnKVxuICB9XG5cbiAgLyoqXG4gICAqIFJldHVybiB0aGUgdmlkZW8gZGF0YSBVUkwgZm9yIGEgdmlkZW9cbiAgICovXG4gIHZpZGVvVXJsIChrZXk6IHN0cmluZywgaWQ6IHN0cmluZykge1xuICAgIHJldHVybiBgL3ZpZGVvLyR7a2V5fS8ke2lkfWBcbiAgfVxuXG4gIC8qKlxuICAgKiBDaGVjayBpZiBhIHByb3ZpZGVkIElEIG1hdGNoZXMgdGhlIEltbWljaCBJRCBmb3JtYXRcbiAgICovXG4gIGlzSWQgKGlkOiBzdHJpbmcpIHtcbiAgICByZXR1cm4gISFpZC5tYXRjaCgvXlswLTlhLWZdezh9LVswLTlhLWZdezR9LVswLTlhLWZdezR9LVswLTlhLWZdezR9LVswLTlhLWZdezEyfSQvKVxuICB9XG5cbiAgLyoqXG4gICAqIENoZWNrIGlmIGEgcHJvdmlkZWQga2V5IG1hdGNoZXMgdGhlIEltbWljaCBzaGFyZWQtbGluayBrZXkgZm9ybWF0XG4gICAqL1xuICBpc0tleSAoa2V5OiBzdHJpbmcpIHtcbiAgICByZXR1cm4gISFrZXkubWF0Y2goL15bXFx3LV0rJC8pXG4gIH1cbn1cblxuY29uc3QgaW1taWNoID0gbmV3IEltbWljaCgpXG5cbmV4cG9ydCBkZWZhdWx0IGltbWljaFxuIl19 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,e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LyR7aWR9YCArIChzaXplID8gYD9zaXplPSR7c2l6ZX1gIDogJycpXG4gIH1cblxuICAvKipcbiAgICogUmV0dXJuIHRoZSB2aWRlbyBkYXRhIFVSTCBmb3IgYSB2aWRlb1xuICAgKi9cbiAgdmlkZW9VcmwgKGtleTogc3RyaW5nLCBpZDogc3RyaW5nKSB7XG4gICAgcmV0dXJuIGAvdmlkZW8vJHtrZXl9LyR7aWR9YFxuICB9XG5cbiAgLyoqXG4gICAqIENoZWNrIGlmIGEgcHJvdmlkZWQgSUQgbWF0Y2hlcyB0aGUgSW1taWNoIElEIGZvcm1hdFxuICAgKi9cbiAgaXNJZCAoaWQ6IHN0cmluZykge1xuICAgIHJldHVybiAhIWlkLm1hdGNoKC9eWzAtOWEtZl17OH0tWzAtOWEtZl17NH0tWzAtOWEtZl17NH0tWzAtOWEtZl17NH0tWzAtOWEtZl17MTJ9JC8pXG4gIH1cblxuICAvKipcbiAgICogQ2hlY2sgaWYgYSBwcm92aWRlZCBrZXkgbWF0Y2hlcyB0aGUgSW1taWNoIHNoYXJlZC1saW5rIGtleSBmb3JtYXRcbiAgICovXG4gIGlzS2V5IChrZXk6IHN0cmluZykge1xuICAgIHJldHVybiAhIWtleS5tYXRjaCgvXltcXHctXSskLylcbiAgfVxufVxuXG5jb25zdCBpbW1pY2ggPSBuZXcgSW1taWNoKClcblxuZXhwb3J0IGRlZmF1bHQgaW1taWNoXG4iXX0= \ No newline at end of file diff --git a/src/immich.ts b/src/immich.ts index d8eba8e..3e71d1e 100644 --- a/src/immich.ts +++ b/src/immich.ts @@ -51,9 +51,9 @@ class Immich { switch (asset.type) { case AssetType.image: size = size === ImageSize.thumbnail ? ImageSize.thumbnail : ImageSize.original - return this.request('/assets/' + asset.id + '/' + size) + return this.request('/assets/' + encodeURIComponent(asset.id) + '/' + size) case AssetType.video: - return this.request('/assets/' + asset.id + '/video/playback') + return this.request('/assets/' + encodeURIComponent(asset.id) + '/video/playback') } }