Added query string in source path to burst cache

Merged Onkar Sutar requested to merge DownloadHelper_CacheBurst into master
Compare and
1 file
+ 8
1
Preferences
File browser
Compare changes
@@ -4,6 +4,7 @@ import (
"errors"
"path"
"path/filepath"
"strconv"
"strings"
"time"
@@ -29,7 +30,13 @@ const (
func DownloadFile(sourcePath, destinationPath, jwtToken string, retryCnt int) (bool, error) {
logginghelper.LogDebug("IN : DownloadFile")
destinationPath = filehelper.CleanPath(destinationPath)
logginghelper.LogDebug("DownloadFile : Downloding ", sourcePath, " at ", destinationPath)
mkclCacheBurst := strconv.FormatInt(time.Now().UnixNano(), 10)
if strings.Contains(sourcePath, "?") {
sourcePath = sourcePath + "&mkclCacheBurst=" + mkclCacheBurst
} else {
sourcePath = sourcePath + "?mkclCacheBurst=" + mkclCacheBurst
}
logginghelper.LogDebug("DownloadFile : Downloading ", sourcePath, " at ", destinationPath)
if strings.Trim(sourcePath, EMPTY_STR) == EMPTY_STR || strings.Trim(destinationPath, EMPTY_STR) == EMPTY_STR || !strings.HasPrefix(sourcePath, HTTP_PROTOCOL) {
logginghelper.LogDebug("DownloadFile : sourcePath is empty")
logginghelper.LogDebug("OUT : DownloadFile")