Ticket #56 (closed defect: fixed)
Newlines get unescaped on their way to the database.
| Reported by: | schuler.steffen | Owned by: | scott |
|---|---|---|---|
| Priority: | critical | Milestone: | awkpaste |
| Component: | awkbot | Version: | 1.0 |
| Keywords: | Cc: |
Description
As reported by steffen schuler:
If one pastes code with the literal ``\n'' inside the code or
in the header, then the pasted output is different.
Reproduction Steps
- Navigate to http://awkpaste.blisted.org/
- Enter the following paste:
# An escaped linefeed print "\n" # An escaped escape and an n. print "\\\n" # An escaped carriage return print "\r" # An escaped esacpe and an r. print "\\r" # escaped escape print "\\" # End of line that's escaped. print "This string is waaaaaaay too large for me to possibly be able " \ "to fit it in a single line" # Some accidental backslashes: \\ # Four backslashes and an n: \\\\n - Observe output.
- Click paste-id link at top left corner of page.
Expected
The paste output from the paste-id link is the same as that returned by the form submission.
Observed
The text \n is translated into a newline in the paste output.
Additionally, the contents of the database are:
mysql> select content from paste where paste_id = '567';
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| content |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| # An escaped linefeed
print "\n"
# An escaped escape and an n.
print "\\n"
# An escaped carriage return
print "\r"
# An escaped esacpe and an r.
print "\\r"
# escaped escape
print "\\"
# End of line that's escaped.
print "This string is waaaaaaay too large for me to possibly be able " \
"to fit it in a single line"
# Some accidental backslashes: \\
# Four backslashes and an n: \\\\n |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
The database content suggests the issue is most likely in the mysql library escaping content coming from the database.
Change History
Note: See
TracTickets for help on using
tickets.