From 081701ef382ea8193674870dcb7da5ee3b01800a Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Fri, 17 May 2024 12:14:54 +0300 Subject: [PATCH] webdav: handle 0 in limitReqBody correctly (#2484) --- library/ix-dev/community/webdav/Chart.yaml | 2 +- library/ix-dev/community/webdav/ci/https-noauth-values.yaml | 1 + library/ix-dev/community/webdav/templates/_helper.tpl | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/library/ix-dev/community/webdav/Chart.yaml b/library/ix-dev/community/webdav/Chart.yaml index 24d3524fa1..06c4bb757a 100644 --- a/library/ix-dev/community/webdav/Chart.yaml +++ b/library/ix-dev/community/webdav/Chart.yaml @@ -4,7 +4,7 @@ description: WebDAV is a set of extensions to the HTTP protocol which allows use annotations: title: WebDAV type: application -version: 1.0.24 +version: 1.0.25 apiVersion: v2 appVersion: 2.4.59 kubeVersion: '>=1.16.0-0' diff --git a/library/ix-dev/community/webdav/ci/https-noauth-values.yaml b/library/ix-dev/community/webdav/ci/https-noauth-values.yaml index 53ae74ec32..7be177879b 100644 --- a/library/ix-dev/community/webdav/ci/https-noauth-values.yaml +++ b/library/ix-dev/community/webdav/ci/https-noauth-values.yaml @@ -11,6 +11,7 @@ webdavStorage: description: My second share hostPath: /mnt/{{.Release.Name }}/share2 readOnly: false + maxRequestBodySizeInGB: 0 fixPermissions: true - name: share3 enabled: false diff --git a/library/ix-dev/community/webdav/templates/_helper.tpl b/library/ix-dev/community/webdav/templates/_helper.tpl index d28670a63a..0bd02f9127 100644 --- a/library/ix-dev/community/webdav/templates/_helper.tpl +++ b/library/ix-dev/community/webdav/templates/_helper.tpl @@ -45,7 +45,11 @@ DavLockDB "/usr/local/apache2/var/DavLock" # Description: {{ .description }} Alias /{{ .name }} "/{{ include "webdav.shares.prefix" $ }}/{{ .name }}" - LimitRequestBody {{ mul (.maxRequestBodySizeInGB | default 1) $bytesGB }} + {{- $maxReqBody := 1 -}} + {{- if not (kindIs "invalid" .maxRequestBodySizeInGB) -}} + {{- $maxReqBody = mul .maxRequestBodySizeInGB $bytesGB -}} + {{- end }} + LimitRequestBody {{ $maxReqBody }} {{- if .readOnly }}