From 421029ebab66c9a6622ba47e56d7f6473524cce4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 11:05:46 +0900 Subject: [PATCH] fix(deps): update dependency axios to v1 (#3202) * fix(deps): update dependency axios to v1 * fix: deal with possibly undefined headers from axios Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sct --- package.json | 2 +- server/lib/imageproxy.ts | 6 ++++-- yarn.lock | 18 ++++++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 8c64ab75d..c19abf865 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@svgr/webpack": "6.5.1", "@tanem/react-nprogress": "5.0.22", "ace-builds": "1.14.0", - "axios": "0.27.2", + "axios": "1.2.2", "axios-rate-limit": "1.3.0", "bcrypt": "5.1.0", "bowser": "2.11.0", diff --git a/server/lib/imageproxy.ts b/server/lib/imageproxy.ts index 34a097d5f..4ba6b97a7 100644 --- a/server/lib/imageproxy.ts +++ b/server/lib/imageproxy.ts @@ -192,9 +192,11 @@ class ImageProxy { const buffer = Buffer.from(response.data, 'binary'); const extension = path.split('.').pop() ?? ''; - const maxAge = Number(response.headers['cache-control'].split('=')[1]); + const maxAge = Number( + (response.headers['cache-control'] ?? '0').split('=')[1] + ); const expireAt = Date.now() + maxAge * 1000; - const etag = response.headers.etag.replace(/"/g, ''); + const etag = (response.headers.etag ?? '').replace(/"/g, ''); await this.writeToCacheDir( directory, diff --git a/yarn.lock b/yarn.lock index b6b479726..40727cd75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4483,13 +4483,14 @@ axios-rate-limit@1.3.0: resolved "https://registry.yarnpkg.com/axios-rate-limit/-/axios-rate-limit-1.3.0.tgz#03241d24c231c47432dab6e8234cfde819253c2e" integrity sha512-cKR5wTbU/CeeyF1xVl5hl6FlYsmzDVqxlN4rGtfO5x7J83UxKDckudsW0yW21/ZJRcO0Qrfm3fUFbhEbWTLayw== -axios@0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== +axios@1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.2.tgz#72681724c6e6a43a9fea860fc558127dbe32f9f1" + integrity sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q== dependencies: - follow-redirects "^1.14.9" + follow-redirects "^1.15.0" form-data "^4.0.0" + proxy-from-env "^1.1.0" axobject-query@^2.2.0: version "2.2.0" @@ -6945,7 +6946,7 @@ fn.name@1.x.x: resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== -follow-redirects@^1.14.9: +follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== @@ -10805,6 +10806,11 @@ proxy-from-env@1.0.0: resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" integrity sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A== +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + psl@^1.1.28: version "1.9.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7"