<!DOCTYPE html>
<meta charset="utf-8" />
<title>Upload files named using punctuation</title>
<link
  rel="help"
  href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"
/>
<link
  rel="help"
  href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"
/>
<link rel="help" href="https://w3c.github.io/FileAPI/#file-constructor" />
<link
  rel="author"
  title="Benjamin C. Wiley Sittler"
  href="mailto:bsittler@chromium.org"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/send-file-form-helper.js"></script>
<script>
  "use strict";

  // These have characters that undergo processing in name=,
  // filename=, and/or value; formPostFileUploadTest postprocesses
  // expectedEncodedBaseName for these internally.

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-QUOTATION-MARK-[\x22].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-QUOTATION-MARK-[\x22].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: '"file-for-upload-in-form-double-quoted.txt"',
    formEncoding: "UTF-8",
    expectedEncodedBaseName: '"file-for-upload-in-form-double-quoted.txt"',
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-REVERSE-SOLIDUS-[\\].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-REVERSE-SOLIDUS-[\\].txt",
  });

  // The rest should be passed through unmodified:

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-EXCLAMATION-MARK-[!].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-EXCLAMATION-MARK-[!].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-DOLLAR-SIGN-[$].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-DOLLAR-SIGN-[$].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-PERCENT-SIGN-[%].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-PERCENT-SIGN-[%].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-AMPERSAND-[&].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-AMPERSAND-[&].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-APOSTROPHE-['].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-APOSTROPHE-['].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-LEFT-PARENTHESIS-[(].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-LEFT-PARENTHESIS-[(].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-RIGHT-PARENTHESIS-[)].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-RIGHT-PARENTHESIS-[)].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-ASTERISK-[*].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-ASTERISK-[*].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-PLUS-SIGN-[+].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-PLUS-SIGN-[+].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-COMMA-[,].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-COMMA-[,].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-FULL-STOP-[.].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-FULL-STOP-[.].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-SOLIDUS-[/].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-SOLIDUS-[/].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-COLON-[:].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-COLON-[:].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-SEMICOLON-[;].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-SEMICOLON-[;].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-EQUALS-SIGN-[=].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-EQUALS-SIGN-[=].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-QUESTION-MARK-[?].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-QUESTION-MARK-[?].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-CIRCUMFLEX-ACCENT-[^].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-CIRCUMFLEX-ACCENT-[^].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-LEFT-SQUARE-BRACKET-[[].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-LEFT-SQUARE-BRACKET-[[].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-RIGHT-SQUARE-BRACKET-[]].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-RIGHT-SQUARE-BRACKET-[]].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-LEFT-CURLY-BRACKET-[{].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-LEFT-CURLY-BRACKET-[{].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-VERTICAL-LINE-[|].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-VERTICAL-LINE-[|].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-RIGHT-CURLY-BRACKET-[}].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName:
      "file-for-upload-in-form-RIGHT-CURLY-BRACKET-[}].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-TILDE-[~].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-TILDE-[~].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "'file-for-upload-in-form-single-quoted.txt'",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "'file-for-upload-in-form-single-quoted.txt'",
  });
</script>
