Browse Source

webdav: allow modifying the request body limit (#2479)

* webdav: allow modifying the request body limit

* update description
Stavros Kois 1 year ago
parent
commit
7791659812

+ 1 - 1
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.23
+version: 1.0.24
 apiVersion: v2
 appVersion: 2.4.59
 kubeVersion: '>=1.16.0-0'

+ 1 - 0
library/ix-dev/community/webdav/ci/http-basicauth-values.yaml

@@ -17,6 +17,7 @@ webdavStorage:
       description: My third disabled share
       hostPath: /mnt/{{.Release.Name }}/share3
       readOnly: true
+      maxRequestBodySizeInGB: 10
       fixPermissions: false
 
 webdavNetwork:

+ 11 - 2
library/ix-dev/community/webdav/questions.yaml

@@ -180,8 +180,8 @@ questions:
                         Example: [share1] will be available at [http://<webdav-ip>:<webdav-port>/share1]
                       schema:
                         type: string
-                        valid_chars: '^[a-zA-Z0-9_-]+$'
-                        valid_chars_error: 'Share name can only consist of [Letters(a-z, A-Z), Numbers(0-9), Underscores(_), Dashes(-)]'
+                        valid_chars: "^[a-zA-Z0-9_-]+$"
+                        valid_chars_error: "Share name can only consist of [Letters(a-z, A-Z), Numbers(0-9), Underscores(_), Dashes(-)]"
                         required: true
                     - variable: description
                       label: Description
@@ -203,6 +203,15 @@ questions:
                       schema:
                         type: boolean
                         default: false
+                    - variable: maxRequestBodySizeInGB
+                      label: Max Request Body Size (in GB)
+                      description: |
+                        The maximum size of the request body in GB.
+                        If the request body size exceeds this value, the request will fail.
+                        Value of 0 means no limit.
+                      schema:
+                        type: int
+                        default: 1
                     - variable: fixPermissions
                       label: Fix Permissions
                       description: |

+ 2 - 0
library/ix-dev/community/webdav/templates/_helper.tpl

@@ -39,11 +39,13 @@ DavLockDB "/usr/local/apache2/var/DavLock"
   Options Indexes FollowSymLinks
 </Directory>
 {{- range .Values.webdavStorage.shares }}
+  {{ $bytesGB := 1073741824 }}
   {{- if .enabled }}
 # WebDav Share - {{ .name }}
 # Description: {{ .description }}
 Alias /{{ .name }} "/{{ include "webdav.shares.prefix" $ }}/{{ .name }}"
 <Directory "/{{ include "webdav.shares.prefix" $ }}/{{ .name }}">
+  LimitRequestBody {{ mul (.maxRequestBodySizeInGB | default 1) $bytesGB }}
 </Directory>
     {{- if .readOnly }}
 <Location "/{{ .name }}">