Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upload of remote media with OpenStack Swift sometimes failing #16998

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

ClearlyClaire
Copy link
Contributor

Under certain conditions, files fetched from remotes trigger an error when being uploaded using OpenStack Swift. This is because in some cases, the remote server will not return a content-length, so our ResponseWithLimitAdapter will hold a nil value for #size, which will lead to an invalid value for the Content-Length header of the Swift API call.

This commit fixes that by taking the size from the actually-downloaded file size rather than the upstream-provided Content-Length header value.

Under certain conditions, files fetched from remotes trigger an error when
being uploaded using OpenStack Swift. This is because in some cases, the
remote server will not return a content-length, so our ResponseWithLimitAdapter
will hold a `nil` value for `#size`, which will lead to an invalid value
for the Content-Length header of the Swift API call.

This commit fixes that by taking the size from the actually-downloaded file
size rather than the upstream-provided Content-Length header value.
@Gargron Gargron merged commit 48f8658 into mastodon:main Nov 16, 2021
Gargron pushed a commit that referenced this pull request Nov 26, 2021
…6998)

Under certain conditions, files fetched from remotes trigger an error when
being uploaded using OpenStack Swift. This is because in some cases, the
remote server will not return a content-length, so our ResponseWithLimitAdapter
will hold a `nil` value for `#size`, which will lead to an invalid value
for the Content-Length header of the Swift API call.

This commit fixes that by taking the size from the actually-downloaded file
size rather than the upstream-provided Content-Length header value.
kadoshita pushed a commit to kadoshita/mastodon that referenced this pull request Nov 28, 2021
…stodon#16998)

Under certain conditions, files fetched from remotes trigger an error when
being uploaded using OpenStack Swift. This is because in some cases, the
remote server will not return a content-length, so our ResponseWithLimitAdapter
will hold a `nil` value for `#size`, which will lead to an invalid value
for the Content-Length header of the Swift API call.

This commit fixes that by taking the size from the actually-downloaded file
size rather than the upstream-provided Content-Length header value.
ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this pull request Jan 28, 2022
…stodon#16998)

Under certain conditions, files fetched from remotes trigger an error when
being uploaded using OpenStack Swift. This is because in some cases, the
remote server will not return a content-length, so our ResponseWithLimitAdapter
will hold a `nil` value for `#size`, which will lead to an invalid value
for the Content-Length header of the Swift API call.

This commit fixes that by taking the size from the actually-downloaded file
size rather than the upstream-provided Content-Length header value.
koba-lab added a commit to koba-lab/mastodon that referenced this pull request Feb 8, 2022
* commit '637c7d464b2876765370d1143b7ba6441efb730b': (698 commits)
  Bump version to 3.3.2
  Fix spurious errors when receiving an Add activity for a private post
  disable legacy XSS filtering (mastodon#17289)
  Change mastodon:webpush:generate_vapid_key task to not require functional env (mastodon#17338)
  Fix response_to_recipient? CTE
  Fix insufficient sanitization of report comments
  Fix compacted JSON-LD possibly causing compatibility issues on forwarding
  Compact JSON-LD signed incoming activities
  Fix error-prone SQL queries (mastodon#15828)
  Change docker-compose.yml to specifically tag v3.3.1 images
  Bump to version 3.3.1
  Save bundle config as local (mastodon#17188)
  Add manual GitHub Actions runs (mastodon#17000)
  Change workflow to push to Docker Hub (mastodon#16980)
  Build container image by GitHub Actions (mastodon#16973)
  Add more advanced migration tests
  Fix edge case in migration helpers that caused crash because of PostgreSQL quirks (mastodon#17398)
  Fix some old migration scripts (mastodon#17394)
  Fix filtering DMs from non-followed users (mastodon#17042)
  Fix upload of remote media with OpenStack Swift sometimes failing (mastodon#16998)
  ...

# Conflicts:
#	CHANGELOG.md
#	Gemfile.lock
#	app/controllers/auth/sessions_controller.rb
#	app/controllers/concerns/sign_in_token_authentication_concern.rb
#	app/controllers/concerns/signature_verification.rb
#	app/controllers/concerns/two_factor_authentication_concern.rb
#	app/javascript/mastodon/components/status_action_bar.js
#	app/javascript/mastodon/features/getting_started/index.js
#	app/javascript/mastodon/locales/ja.json
#	app/javascript/styles/mastodon/boost.scss
#	app/lib/activitypub/activity/announce.rb
#	app/lib/activitypub/activity/create.rb
#	app/lib/formatter.rb
#	app/lib/webfinger.rb
#	app/models/user.rb
#	app/services/fan_out_on_write_service.rb
#	app/services/resolve_account_service.rb
#	app/views/statuses/_detailed_status.html.haml
#	app/views/statuses/_simple_status.html.haml
#	chart/Chart.yaml
#	chart/values.yaml.template
#	db/migrate/20200620164023_add_fixed_lowercase_index_to_accounts.rb
#	lib/cli.rb
#	lib/mastodon/maintenance_cli.rb
#	lib/paperclip/response_with_limit_adapter.rb
#	package.json
#	spec/controllers/auth/sessions_controller_spec.rb
#	spec/services/resolve_account_service_spec.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants