Closed
Description
- Gitea version (or commit ref): 1.8.0
- Git version: 2.21.0
- Operating system: Linux (Debian Buster)
- Database (use
[x]
):- MySQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Not relevant
- Log gist:
When exporting via gitea dump
,the \n
at then end of commit message title (in column content
of table action
) is not properly escaped.
I've checked that this happens when exporting both from MySQL and NoSQL databases. As an example,
$ ./gitea dump
$ unzip -j gitea-dump-1557579865.zip gitea-db.sql `pwd`/gitea-db.sql
$ grep "66fd8c3d224c1f358f57d242374563ad55543761" gitea-db.sql
INSERT INTO `action` (`id`, `user_id`, `op_type`, `act_user_id`, `repo_id`, `comment_id`, `is_deleted`, `ref_name`, `is_private`, `content`, `created_unix`) VALUES (894, 1, 5, 1, 1, 0, false, 'master', true, '{"Len":1,"Commits":[{"Sha1":"66fd8c3d224c1f358f57d242374563ad55543761","Message":"test \\n \\r \\t\n","AuthorEmail":"[email protected]","AuthorName":"Saman Ghannadzadeh","CommitterEmail":"[email protected]","CommitterName":"Saman Ghannadzadeh","Timestamp":"2019-05-11T13:31:40+01:00"}],"CompareURL":"saman/dotfiles/compare/5f81ccf3c05313658d4a9edd817526046e6a8cef...66fd8c3d224c1f358f57d242374563ad55543761"}', 1557577915);
Notice the Message":"test \\n \\r \\t\n"
. The special characters are escpaed, except the last \n
.
This can cause mashalling errors when the dump is later imported into a database, see #6793.