<commit_before>import NativePromise from "native-promise-only"
import XHR from "./xhr"
const s3 = (formio) => ({
    uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId) {
        return XHR.upload(
            formio,
            "s3",
            (xhr, response) => {
                response.data.fileName = fileName
                response.data.key = XHR.path([response.data.key, dir, fileName])
                const setXhrHeaders = (xhrToSet) => {
                    const { headers } = formio.options
                    if (headers) {
                        const ValidHeaders = {
                            "Content-Disposition": true,
                        }
                        for (const header in headers) {
                            if (ValidHeaders[header]) {
                                xhrToSet.setRequestHeader(
                                    header,
                                    headers[header]
                                )
                            }
                        }
                    }
                }
                if (response.signed) {
                    xhr.open("PUT", response.signed)
                    xhr.setRequestHeader("Content-Type", file.type)
                    setXhrHeaders(xhr)
                    return file
                } else {
                    const fd = new FormData()
                    for (const key in response.data) {
                        fd.append(key, response.data[key])
                    }
                    fd.append("file", file)
                    xhr.open("POST", response.url)
                    setXhrHeaders(xhr)
                    return fd
                }
            }, file, fileName, dir, progressCallback, groupPermissions, groupId).then((response) => {
            return {
                storage: "s3",
                name: fileName,
                bucket: response.bucket,
                key: response.data.key,
                url: XHR.path([response.url, response.data.key]),
                acl: response.data.acl,
                size: file.size,
                type: file.type
            }
        })
    },
    downloadFile(file) {
        if (file.acl !== "public-read") {
            return formio.makeRequest("file", `${formio.formUrl}/storage/s3?bucket=${XHR.trim(file.bucket)}&key=${XHR.trim(file.key)}`, "GET");
        } else {
            return NativePromise.resolve(file);
        }
    }
})

s3.title = "S3"
export default s3<commit_msg>Undo eslint changes to file<commit_after>import NativePromise from 'native-promise-only';
import XHR from './xhr';
const s3 = (formio) => ({
  uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId) {
    return XHR.upload(formio, "s3", (xhr, response) => {
      response.data.fileName = fileName
      response.data.key = XHR.path([response.data.key, dir, fileName])
      const setXhrHeaders = (xhrToSet) => {
        const { headers } = formio.options
        if (headers) {
          const ValidHeaders = {
            "Content-Disposition": true,
          }
          for (const header in headers) {
            if (ValidHeaders[header]) {
              xhrToSet.setRequestHeader(
                header,
                headers[header]
              )
            }
          }
        }
      }
      if (response.signed) {
        xhr.open("PUT", response.signed)
        xhr.setRequestHeader("Content-Type", file.type)
        setXhrHeaders(xhr)
        return file
      } else {
        const fd = new FormData()
        for (const key in response.data) {
          fd.append(key, response.data[key])
        }
        fd.append("file", file)
        xhr.open("POST", response.url)
        setXhrHeaders(xhr)
        return fd
      }
    }, file, fileName, dir, progressCallback, groupPermissions, groupId).then((response) => {
      return {
        storage: "s3",
        name: fileName,
        bucket: response.bucket,
        key: response.data.key,
        url: XHR.path([response.url, response.data.key]),
        acl: response.data.acl,
        size: file.size,
        type: file.type
      }
    })
  },
  downloadFile(file) {
    if (file.acl !== "public-read") {
      return formio.makeRequest("file", `${formio.formUrl}/storage/s3?bucket=${XHR.trim(file.bucket)}&key=${XHR.trim(file.key)}`, "GET");
    } else {
      return NativePromise.resolve(file);
    }
  }
})

s3.title = "S3"
export default s3
{'fraction_non_alphanumeric': 0.11806323236789741, 'fraction_numerical': 0.0030952907362370107, 'mean_word_length': 1.4089456869009584, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2984161', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1223, 'n_words': 246}