Remove double quotes and backslash escapes from a header value. This is the reverse of :func:`quote_header_value`. :param value: The header value to unquote. .. versionchanged:: 3.2 Removes escape preceding any character. .. versionchanged:: 3.0 The ``is_filename`
(value: str)
| 175 | |
| 176 | |
| 177 | def unquote_header_value(value: str) -> str: |
| 178 | """Remove double quotes and backslash escapes from a header value. |
| 179 | |
| 180 | This is the reverse of :func:`quote_header_value`. |
| 181 | |
| 182 | :param value: The header value to unquote. |
| 183 | |
| 184 | .. versionchanged:: 3.2 |
| 185 | Removes escape preceding any character. |
| 186 | |
| 187 | .. versionchanged:: 3.0 |
| 188 | The ``is_filename`` parameter is removed. |
| 189 | """ |
| 190 | if len(value) >= 2 and value[0] == value[-1] == '"': |
| 191 | return _unslash_re.sub(r"\g<1>", value[1:-1]) |
| 192 | |
| 193 | return value |
| 194 | |
| 195 | |
| 196 | def dump_options_header(header: str | None, options: t.Mapping[str, t.Any]) -> str: |
no outgoing calls
no test coverage detected