Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • M mwbot
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Custom issue tracker
    • Custom issue tracker
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • repos
  • mwbot-rs
  • mwbot
  • Merge requests
  • !17

Add support for file uploads

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Legoktm requested to merge upload into main Jan 16, 2023
  • Overview 0
  • Commits 4
  • Pipelines 16
  • Changes 13

The main difference from normal requests is that uploads require sending files in multipart requests. These requests are also generally not retriable since it might be referring to a Stream (not yet implemented) that can't be cloned. The logic of making requests has been extracted so it can be called independently.

As part of this refactor, we had to move the retry-after header handling into the error itself. Unfortunately this is a breaking change since it changes the error types, so we can make a few other changes like replacing should_retry() with retry_after().

By default, files are uploaded in chunks of 5MB. This can be adjusted depending on the wiki you're uploading to and bandwidth. If the wiki supports it, async mode will be used too. Upload-by-url is not supported yet, mostly because the MediaWiki implementation is pretty busted and you're better off downloading it on your own.

Bug: T319098

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: upload