tact / public

Tact app public community site.
10 stars 0 forks source link

[BUG] Exporting a chat that has double quotes in its name produces an HTML file that fails to render data #109

Closed siimpragi closed 2 years ago

siimpragi commented 2 years ago

Describe the bug

When you export a chat that has certain characters in its name (e.g. ") the HTML that is produced gets jumbled.

Environment

To reproduce

Steps to reproduce the behavior:

  1. Create a new chat that has " in its name
  2. Export that chat
  3. Open index.html from the directory that got created

Expected behavior

index.html should render the chatlog.

Observed behavior

The page didn't render any data.

Any other info

For example, exporting a chat named 'The "Good" Guys' gives us an index.html containing:

<html>
<head>
<title>Exported Chat</title>
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="stylesheet" href="style.css" />
<script src="JSON/The "Good" Guys.js"></script>
<script src="render.js"></script>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<div id="header">
</div>
<div id="content">
</div>
</body>
</html>

Note that the file containing all that JSON data was given the same name as the chat itself. That filename is injected straight into the URI string. The markup gets messed up as a result. Could content.chat.id perhaps be used as the filename instead?

jaanus commented 2 years ago

Thank you for the report. Cool/real bug, will fix.

In general, we built the export feature in scrappy/MVP way. It barely functions, but has many things we know we can improve. If there are specific things which cause breakage (like this one) or just very big annoyances, feel free to file other specific items about those.

jaanus commented 2 years ago

Fixed in 1.2 (159).