From d6cefcbb4bb3ed7d00fe3c85ec9c5ccad990bef0 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 19 Dec 2016 19:08:56 +0100 Subject: [PATCH] Make application/x-www-form-urlencoded encode filenames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’ll leave converting an OS filename to a JavaScript string to someone else for now. Fixes #109. --- url.bs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/url.bs b/url.bs index 044f23f6..4e6fe617 100644 --- a/url.bs +++ b/url.bs @@ -2311,28 +2311,31 @@ takes a list of name-value or name-value-type tuples tuples, optional

For each tuple in tuples, run these substeps:

    -
  1. Let outputPair be a new name-value pair. +

  2. Let name be the result of serializing + the result of encoding tuple's name, using encoding. -

  3. Set outputPair's name to the result of - serializing the result of encoding - tuple's name, using encoding. +

  4. Let value be tuple's value. -

  5. If tuple has a type, tuple's type is "hidden", and - outputPair's name is "_charset_", set outputPair's value to - encoding's name. +

  6. +

    If tuple has a type, then: -

  7. Otherwise, if tuple has a type, and tuple's type is - "file", set outputPair's value to tuple's value's filename. +

      +
    1. If tuple's type is "hidden" and name is + "_charset_", then set value to encoding's + name. -

    2. Otherwise, set outputPair's value to the result of - serializing the result of encoding - tuple's value, using encoding. +

    3. Otherwise, if tuple's type is "file", then set value + to value's filename. +

    + +
  8. Set value to the result of serializing + the result of encoding value, using encoding.

  9. If tuple is not the first pair in tuples, then append "&" to output. -

  10. Append outputPair's name, followed by "=", followed by - outputPair's value, to output. +
  11. Append name, followed by "=", followed by value, to + output.
  • Return output.