aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2016-06-16 20:05:39 +0200
committerclsr <clsr@clsr.net>2016-06-16 20:05:39 +0200
commit629fcd4f297ffb34b4f3b54326645eabd42ab32c (patch)
tree7c0ca9d1180b5c848b3d9d23690577aa6bd426dd
parent81d6bc357a7b0d49ba0c5034f77404dc577cf8aa (diff)
downloadgomf-629fcd4f297ffb34b4f3b54326645eabd42ab32c.tar.gz
gomf-629fcd4f297ffb34b4f3b54326645eabd42ab32c.zip
Improve automatic generation of upload URL
-rw-r--r--USAGE3
-rw-r--r--main.go12
2 files changed, 12 insertions, 3 deletions
diff --git a/USAGE b/USAGE
index 3cd76a4..fb742fc 100644
--- a/USAGE
+++ b/USAGE
@@ -66,7 +66,7 @@ Running
--forbid-ext EXTS
forbids file extensions contained in the comma-separated list EXTS
- example: --forbid-ext exe,dll,src
+ example: --forbid-ext exe,dll,scr
--forbid-mime TYPES
forbids MIME types contained in the comma-separated list TYPES
@@ -86,6 +86,7 @@ Running
--upload-url URL
uses URL as the prefix for address of uploaded files
+ if missing, uses --upload-host, --https or --http to construct the URL
example: --upload-url http://u.example.com/
--grill
diff --git a/main.go b/main.go
index ad8711c..d795cb6 100644
--- a/main.go
+++ b/main.go
@@ -71,9 +71,17 @@ func main() {
if uploadUrl == "" {
if *listenHttps != "" {
- uploadUrl = "https://" + *listenHttps + "/u/"
+ if uploadHost != "" {
+ uploadUrl = "https://" + uploadHost + "/"
+ } else {
+ uploadUrl = "https://" + *listenHttps + "/u/"
+ }
} else if *listenHttp != "" {
- uploadUrl = "http://" + *listenHttp + "/u/"
+ if uploadHost != "" {
+ uploadUrl = "http://" + uploadHost + "/"
+ } else {
+ uploadUrl = "http://" + *listenHttp + "/u/"
+ }
}
}