summaryrefslogtreecommitdiff
path: root/internal/transport
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-09-29 21:50:43 +0100
committerLibravatar GitHub <noreply@github.com>2022-09-29 21:50:43 +0100
commit1d999712e6902414bbac30db8a5603758c5c539c (patch)
tree6d4da7aaa8c1e7fc94c5723703f13e5b6d062dfc /internal/transport
parent[chore] Add ipv6 localhost to trusted proxies by default (#868) (diff)
downloadgotosocial-1d999712e6902414bbac30db8a5603758c5c539c.tar.xz
[feature] update config types to use bytesize.Size (#828)
* update config size types to use bytesize.Size * submit unchecked-out file ... :facepalm: * fix bytesize config var decoding * bump bytesize version * update kim's libraries in readme * update envparse.sh to output more useful errors * improve envparse.sh * remove reliance on jq * instead, use uint64 for bytesize flag types * remove redundant type * fix viper unmarshaling * Update envparsing.sh * fix envparsing test Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Diffstat (limited to 'internal/transport')
-rw-r--r--internal/transport/derefmedia.go4
-rw-r--r--internal/transport/transport.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/internal/transport/derefmedia.go b/internal/transport/derefmedia.go
index 8feb7ed20..14c054cdf 100644
--- a/internal/transport/derefmedia.go
+++ b/internal/transport/derefmedia.go
@@ -26,7 +26,7 @@ import (
"net/url"
)
-func (t *transport) DereferenceMedia(ctx context.Context, iri *url.URL) (io.ReadCloser, int, error) {
+func (t *transport) DereferenceMedia(ctx context.Context, iri *url.URL) (io.ReadCloser, int64, error) {
// Build IRI just once
iriStr := iri.String()
@@ -50,5 +50,5 @@ func (t *transport) DereferenceMedia(ctx context.Context, iri *url.URL) (io.Read
return nil, 0, fmt.Errorf("GET request to %s failed (%d): %s", iriStr, rsp.StatusCode, rsp.Status)
}
- return rsp.Body, int(rsp.ContentLength), nil
+ return rsp.Body, rsp.ContentLength, nil
}
diff --git a/internal/transport/transport.go b/internal/transport/transport.go
index 80710a519..5af8b738e 100644
--- a/internal/transport/transport.go
+++ b/internal/transport/transport.go
@@ -47,7 +47,7 @@ import (
type Transport interface {
pub.Transport
// DereferenceMedia fetches the given media attachment IRI, returning the reader and filesize.
- DereferenceMedia(ctx context.Context, iri *url.URL) (io.ReadCloser, int, error)
+ DereferenceMedia(ctx context.Context, iri *url.URL) (io.ReadCloser, int64, error)
// DereferenceInstance dereferences remote instance information, first by checking /api/v1/instance, and then by checking /.well-known/nodeinfo.
DereferenceInstance(ctx context.Context, iri *url.URL) (*gtsmodel.Instance, error)
// Finger performs a webfinger request with the given username and domain, and returns the bytes from the response body.