Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Aug 24, 2023
1 parent baed2db commit 66c714d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
4 changes: 1 addition & 3 deletions packages/@uppy/aws-s3-multipart/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,8 @@ export default class AwsS3Multipart extends BasePlugin {

const promises = filesFiltered.map((file) => {
if (file.isRemote) {
// TODO: why do we need to do this? why not always one or the other?
const Client = file.remote.providerOptions.provider ? Provider : RequestClient
const getQueue = () => this.requests
const client = new Client(this.uppy, file.remote.providerOptions, getQueue)
const client = new Provider(this.uppy, file.remote.providerOptions, getQueue)
this.#setResumableUploadsCapability(false)
const controller = new AbortController()

Expand Down
9 changes: 1 addition & 8 deletions packages/@uppy/aws-s3/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,6 @@ export default class AwsS3 extends BasePlugin {
? opts.allowedMetaFields
// Send along all fields by default.
: Object.keys(file.meta)
// TODO: do we need tus in aws-s3?
if (file.tus) {
// Install file-specific upload overrides.
Object.assign(opts, file.tus)
}
return {
...file.remote.body,
protocol: 'multipart',
Expand All @@ -278,10 +273,8 @@ export default class AwsS3 extends BasePlugin {
if (file.error) throw new Error(file.error)

if (file.isRemote) {
// TODO: why do we need to do this? why not always one or the other?
const Client = file.remote.providerOptions.provider ? Provider : RequestClient
const getQueue = () => this.#requests
const client = new Client(this.uppy, file.remote.providerOptions, getQueue)
const client = new Provider(this.uppy, file.remote.providerOptions, getQueue)
const controller = new AbortController()

const removedHandler = (removedFile) => {
Expand Down
6 changes: 2 additions & 4 deletions packages/@uppy/tus/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BasePlugin from '@uppy/core/lib/BasePlugin.js'
import * as tus from 'tus-js-client'
import { Provider, RequestClient } from '@uppy/companion-client'
import { Provider } from '@uppy/companion-client'
import EventManager from '@uppy/utils/lib/EventManager'
import NetworkError from '@uppy/utils/lib/NetworkError'
import isNetworkError from '@uppy/utils/lib/isNetworkError'
Expand Down Expand Up @@ -475,10 +475,8 @@ export default class Tus extends BasePlugin {
const total = files.length

if (file.isRemote) {
// TODO: why do we need to do this? why not always one or the other?
const Client = file.remote.providerOptions.provider ? Provider : RequestClient
const getQueue = () => this.requests
const client = new Client(this.uppy, file.remote.providerOptions, getQueue)
const client = new Provider(this.uppy, file.remote.providerOptions, getQueue)
const controller = new AbortController()

const removedHandler = (removedFile) => {
Expand Down
6 changes: 2 additions & 4 deletions packages/@uppy/xhr-upload/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BasePlugin from '@uppy/core/lib/BasePlugin.js'
import { nanoid } from 'nanoid/non-secure'
import { Provider, RequestClient } from '@uppy/companion-client'
import { Provider } from '@uppy/companion-client'
import EventManager from '@uppy/utils/lib/EventManager'
import ProgressTimeout from '@uppy/utils/lib/ProgressTimeout'
import { RateLimitedQueue, internalRateLimitedQueue } from '@uppy/utils/lib/RateLimitedQueue'
Expand Down Expand Up @@ -466,10 +466,8 @@ export default class XHRUpload extends BasePlugin {
const total = files.length

if (file.isRemote) {
// TODO: why do we need to do this? why not always one or the other?
const Client = file.remote.providerOptions.provider ? Provider : RequestClient
const getQueue = () => this.requests
const client = new Client(this.uppy, file.remote.providerOptions, getQueue)
const client = new Provider(this.uppy, file.remote.providerOptions, getQueue)
const controller = new AbortController()

const removedHandler = (removedFile) => {
Expand Down

0 comments on commit 66c714d

Please sign in to comment.