From 61bea6b4710e5a30b01912357801970d79d7a9b6 Mon Sep 17 00:00:00 2001 From: Javier Evans Date: Fri, 18 Aug 2023 14:49:10 -0700 Subject: [PATCH] make the isDirectory check simpler and more inclusive of error states --- common/etc/nginx/include/s3gateway.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/common/etc/nginx/include/s3gateway.js b/common/etc/nginx/include/s3gateway.js index 4db6dde5..2ca140ec 100644 --- a/common/etc/nginx/include/s3gateway.js +++ b/common/etc/nginx/include/s3gateway.js @@ -451,18 +451,9 @@ function _escapeURIPath(uri) { * @private */ function _isDirectory(path) { - // if (!path) return false; - // str.slice(-1); - if (path === undefined) { - return false; - } - const len = path.length; - - if (len < 1) { - return false; - } + if (!path) return false; - return path.charAt(len - 1) === '/'; + return path.slice(-1) === '/'; } /**