diff --git a/README.md b/README.md index 642e17d..b83363c 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ - `--gitbucket.home=[DATA_DIR]` - `--temp_dir=[TEMP_DIR]` - `--max_file_size=[MAX_FILE_SIZE]` +- `--upload_timeout=[MAX_UPLOAD_TIMEOUT]` `TEMP_DIR` is used as the [temporary directory for the jetty application context](https://www.eclipse.org/jetty/documentation/9.3.x/ref-temporary-directories.html). This is the directory into which the `gitbucket.war` file is unpacked, the source files are compiled, etc. If given this parameter **must** match the path of an existing directory or the application will quit reporting an error; if not given the path used will be a `tmp` directory inside the gitbucket home. diff --git a/src/main/java/JettyLauncher.java b/src/main/java/JettyLauncher.java index 274654a..93f27ef 100644 --- a/src/main/java/JettyLauncher.java +++ b/src/main/java/JettyLauncher.java @@ -42,6 +42,9 @@ case "--max_file_size": System.setProperty("gitbucket.maxFileSize", dim[1]); break; + case "--upload_timeout": + System.setProperty("gitbucket.UploadTimeout", dim[1]); + break; case "--gitbucket.home": System.setProperty("gitbucket.home", dim[1]); break; diff --git a/src/main/scala/gitbucket/core/util/FileUtil.scala b/src/main/scala/gitbucket/core/util/FileUtil.scala index 5da060d..e3e50ac 100644 --- a/src/main/scala/gitbucket/core/util/FileUtil.scala +++ b/src/main/scala/gitbucket/core/util/FileUtil.scala @@ -96,4 +96,10 @@ else 3 * 1024 * 1024 + lazy val UploadTimeout = + if (System.getProperty("gitbucket.UploadTimeout") != null) + System.getProperty("gitbucket.UploadTimeout").toLong + else + 3 * 10000 + } diff --git a/src/main/twirl/gitbucket/core/helper/attached.scala.html b/src/main/twirl/gitbucket/core/helper/attached.scala.html index 45469ac..15a822a 100644 --- a/src/main/twirl/gitbucket/core/helper/attached.scala.html +++ b/src/main/twirl/gitbucket/core/helper/attached.scala.html @@ -66,6 +66,8 @@ @dropzone(clickable: Boolean, textareaId: Option[String]) = { url: '@context.path/upload/file/@repository.owner/@repository.name', maxFilesize: @{FileUtil.MaxFileSize / 1024 / 1024}, + //timeout defaults to 30 secs + timeout: @{FileUtil.UploadTimeout}, clickable: @clickable, previewTemplate: "
\n
Uploading your files...
\n
\n
", success: function(file, id) { diff --git a/src/main/twirl/gitbucket/core/releases/form.scala.html b/src/main/twirl/gitbucket/core/releases/form.scala.html index 7845d1e..ba15b2b 100644 --- a/src/main/twirl/gitbucket/core/releases/form.scala.html +++ b/src/main/twirl/gitbucket/core/releases/form.scala.html @@ -73,6 +73,8 @@ $("#drop").dropzone({ maxFilesize: @{gitbucket.core.util.FileUtil.MaxFileSize / 1024 / 1024}, url: '@context.path/upload/release/@repository.owner/@repository.name/@helpers.encodeRefName(tag.name)', + //timeout defaults to 30 secs + timeout: @{gitbucket.core.util.FileUtil.UploadTimeout}, previewTemplate: "
\n
Uploading your files...
\n
\n
", success: function(file, id) { var attach =