fix: 2.6-stable - fixes
This commit is contained in:
parent
af5aaa528c
commit
b05c444a0a
@ -1,4 +1,4 @@
|
||||
# HMAC File Server 2.5-Stable
|
||||
# HMAC File Server 2.6-Stable
|
||||
|
||||
## Overview
|
||||
The **HMAC File Server** ensures secure file uploads and downloads using HMAC authentication. It incorporates rate limiting, CORS support, retries, file versioning, and Unix socket support for enhanced flexibility. Redis integration provides efficient caching and session management. Prometheus metrics and a graceful shutdown mechanism ensure reliable and efficient file handling.
|
||||
@ -202,4 +202,4 @@ in the Software without restriction, including without limitation the rights to
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
@ -514,7 +514,6 @@ func main() {
|
||||
log.Fatalf("Insufficient free space: %v", err)
|
||||
}
|
||||
|
||||
initializeWorkerSettings(&conf.Server, &conf.Workers, &conf.ClamAV)
|
||||
log.Info("Prometheus metrics initialized.")
|
||||
|
||||
networkEvents = make(chan NetworkEvent, 100)
|
||||
@ -1790,18 +1789,9 @@ func handleUpload(w http.ResponseWriter, r *http.Request, absFilename, fileStore
|
||||
}
|
||||
|
||||
// Determine the final filename based on the FileNaming configuration
|
||||
finalFilename := absFilename
|
||||
switch conf.Server.FileNaming {
|
||||
case "HMAC":
|
||||
finalFilename = filepath.Join(filepath.Dir(absFilename), hex.EncodeToString(calculatedMAC)+filepath.Ext(absFilename))
|
||||
case "None", "none":
|
||||
// Do nothing: keep finalFilename as-is
|
||||
default:
|
||||
log.Warnf("Unrecognized filenaming config %q, skipping rename.", conf.Server.FileNaming)
|
||||
}
|
||||
|
||||
finalFilename := getFinalFilename(absFilename)
|
||||
// Create temp file and write the uploaded data
|
||||
tempFilename := finalFilename + ".tmp"
|
||||
tempFilename := getTempFilename(finalFilename)
|
||||
err = createFile(tempFilename, r)
|
||||
if err != nil {
|
||||
log.WithFields(logrus.Fields{
|
||||
@ -2751,4 +2741,13 @@ func setupRouter() *http.ServeMux {
|
||||
router := http.NewServeMux()
|
||||
router.HandleFunc("/", handleRequest)
|
||||
return router
|
||||
}
|
||||
|
||||
func getFinalFilename(absFilename string) string {
|
||||
// Use config if needed, or just return absFilename for now
|
||||
return absFilename
|
||||
}
|
||||
|
||||
func getTempFilename(filename string) string {
|
||||
return filename + ".tmp"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user