* 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
- 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 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>
* 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>
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.
* issue #420 return 400 response when Max-Days is too big
* issue #420 moved the Max-Days check before saving the metadata
* issue #420 added a logging message when Max-Days is invalid
* issue #420 added MaxDate.IsZero() check
Co-authored-by: kugiyasan <kugiyasan@users.noreply.github.com>
For files that have no limit, there is no reason to track the download counter as its value will never be used anyway. This reduces costs on storage backends that have an operation fee (e.g. AWS S3) or a minimum retention (e.g. Wasabi S3).