From 629fcd4f297ffb34b4f3b54326645eabd42ab32c Mon Sep 17 00:00:00 2001 From: clsr Date: Thu, 16 Jun 2016 20:05:39 +0200 Subject: Improve automatic generation of upload URL --- USAGE | 3 ++- main.go | 12 ++++++++++-- 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/" + } } } -- cgit