* Upgrade aws-sdk-go to v2
`aws-sdk-go-v2` is the newer SDK version, replacing the one being used
at the moment by the project.
This change maintains full compatibility with existing flags and
configurations, and only replaces the underlying library.
* Simplify and isolate AWS config logic
Running `go mod download` before copying the entire project to the
Docker image avoids dependencies from being re-downloaded every time any
file is modified, and `docker build` runs again.
This follows the steps detailed in the official Docker guide for Go
images:
https://docs.docker.com/language/golang/build-images/#create-a-dockerfile-for-the-application
Also, `GO111MODULE` doesn't make any difference for the supported
Go versions, so it can be removed from the Dockerfile.
- changing the line `purgeTime = s.purgeDays.String()` to use a function that formats the days like this: "N days" or "1 day"
- adding the function `formatDurationDays` in utils.go file
Fixes#557
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
`urfave/cli` v2 was released in 2019, and it doesn't introduce relevant
user-facing breaking changes.
Migration guide from v1 can be found at: https://cli.urfave.org/migrate-v1-to-v2/
The only user-facing change is within the "Flags before args" section,
but I haven't found that to affect `transfer.sh` as arguments are not
used.
Co-authored-by: Stefan Benten <mail@stefan-benten.de>
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
* Add charset to content type in getHandler
Add charset to content type in the getHandler function to fix CJK-letter related issues.
If the content type is empty after trimming, set it to "text/plain; charset=utf-8".
* Add mailcap and mime.types to transfer.sh container
This commit includes /etc/mime.types file to the container, which is necessary to properly select the charset using MIME typing during file upload.
For more information, read https://github.com/dutchcoders/transfer.sh/pull/545#issuecomment-1528712181
---------
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
Use Go 1.20 by default in Dockerfile
Updating the default Go version used in the Dockerfile, to the latest
one supported by the project at the moment.
Also, Go `1.17` support was removed in
9f1fe62e05
Add charset to content type in the getHandler function to fix CJK-letter related issues.
If the content type is empty after trimming, set it to "text/plain; charset=utf-8".
* gpg encryption support
* gpg encryption support
* refinement
* refactor using protonmail opengpg
* warning
* remove exception in linting
* reduce I/O on decrypt
* fix typo
* streaming in encrypt
* Update README.md
do not reference server public hosting version in encrypt/decrypt headers example
* linting
* linting fix
* increase default random-token-length to 10
* Support Range header for GET
* Adds 'Accept-Ranges: bytes' header to handlers
* proper param name in error
* bump gdrive dependecies
* refactor CloseCheck to avoid panic on nil, remove range/audio/video special handling on get handler
* refactor CloseCheck to avoid panic on nil, handle range with no limit
* refactor CloseCheck to avoid panic on nil, handle range in gdrive storage
* refactor CloseCheck to avoid panic on nil
* handle range with no limit
* lint
* bump deps
* go mod tidy
* gofmt
* cr fixes, replace deprecated ioutil.NopCloser
* linting
* do not write to file by default
* fix storj
---------
Co-authored-by: Vladislav Grubov <vladgrubov@gmail.com>
--total --block-size="K" --dereference were all unrecognized flags for this script. I have updated them to the correct flags to run correctly.
Co-authored-by: Stefan Benten <mail@stefan-benten.de>
* Fixed improper implementation of content type
Add text/plain content type if metadata.ContentType is unable to determine the content type of the file
* Update server/handlers.go
Co-authored-by: Farhan Khursheed <41877347+blind-intruder@users.noreply.github.com>
* Update handlers.go
let's trim space
* Update handlers.go
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
* go.mod,go.sum: Update storj dependencies
* bump go version
* another bump to latest storj release
* set minimum go version in go.mod
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
In order to prevent viewing content, which max-download rate has been reached,
we need to ensure the data is not stored locally in a browser cache.
To achieve this, we set the Cache-Control Setting to "no-store" according to:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Controlfixes#470
* Add X-Url-Delete-* headers to POST handler
* Remove token from header
* Fix writing of headers
* Handle error returned by Write
* Update handlers.go
Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
This change propagates the context of the actual user request through.
Additionally it configures the Storj Backend to do in memory buffering instead of relying on temporary files in /tmp/ folders.
Fixes#448
This change moves a couple of defers in order to prevent them from not being executed since we have returned in error cases early.
It also fixes a couple of smaller linting issues, like error messages not starting with a capital letter and variable name collisions with imported packages.