owncloud / owncloud/ocis

Gateway in REVA is logging error for upload HEAD requests

Open
#11,242 1 comment 0 reactions 0 assignees View on GitHub
Type:Bug
Dominant language
Go
Stars
2.1k
Forks
274
Avg merge
2d 1h
Merged PRs (30d)
103

Description

## Describe the bug

When starting a TUS upload via Web, the first fired request is a HEAD. This request holds no body nor `Content-Size` header. In the REVA datagateway, it produces however an error log due to a mismatch between `Content-Size` header and the size of body of request: `ERR content length vs transferred bytes mismatch content-length=52428800000 line=/Users/lukashirt/work/ownCloud/ocis/vendor/github.com/owncloud/reva/v2/internal/http/services/datagateway/datagateway.go:226 pkg=rhttp request-id=e9850097-c8c8-4d07-8078-655bed537acf service=frontend traceid=84dc96563b75bab09e2aab4b4d7847b4 transferred-bytes=0`

This is the line that logs it: https://github.com/owncloud/reva/blob/be486343903bbc2acf167a8e8d51e161f921ef7f/internal/http/services/datagateway/datagateway.go#L226

## Steps to reproduce
1. Start an upload

## Expected behavior

No error log for the HEAD request.

## Actual behavior

Error log is printed.

## Setup
Please describe how you started the server and provide a list of relevant environment variables or configuration files.

```console
IDM_ADMIN_PASSWORD=admin
OCIS_URL=https://localhost:9200
OCIS_LOG_PRETTY=true
OCIS_LOG_COLOR=true
OCIS_INSECURE=true
PROXY_ENABLE_BASIC_AUTH=true
OCIS_LOG_LEVEL=debug
OCIS_ENABLE_OCM=true
IDM_ADMIN_PASSWORD=admin
OCIS_CORS_ALLOW_ORIGINS="https://localhost:9201,https://localhost:9200"
OCIS_CORS_ALLOW_HEADERS="Origin,Accept,Content-Type,Depth,Authorization,Ocs-Apirequest,If-None-Match,If-Match,Destination,Overwrite,X-Request-Id,X-Requested-With,Tus-Resumable,Tus-Checksum-Algorithm,Upload-Concat,Upload-Length,Upload-Metadata,Upload-Defer-Length,Upload-Expires,Upload-Checksum,Upload-Offset,X-HTTP-Method-Override,cache-control,Accept-Language,Initiator-Id,Referer,Sec-Ch-Ua,Sec-Ch-Ua-Mobile,Sec-Ch-Ua-Platform,User-Agent,Content-Disposition,X-OC-Mtime"
FRONTEND_CONFIGURABLE_NOTIFICATIONS=true
PROXY_CSP_CONFIG_FILE_LOCATION=/Users/lukashirt/.ocis/config/csp.yaml
FRONTEND_ARCHIVER_MAX_SIZE=10000000000
OCIS_CORS_ALLOW_METHODS="PATCH,PUT,GET,PROPFIND,DELETE,OPTIONS,POST"
```

## Additional context

Tested with latest commit on master (20f32d4f2a7f9b095cf075a07e66dd8b67f4c887). I wanted to create this issue in https://github.com/owncloud/reva but since the Issues tab is hidden, I assume they are disabled. Even though visiting https://github.com/owncloud/reva/issues/new displays the form 😅

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.