Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] copying raw pastes lead to double blank lines #433

Open
oliverbooth opened this issue Aug 10, 2023 · 4 comments
Open

[bug] copying raw pastes lead to double blank lines #433

oliverbooth opened this issue Aug 10, 2023 · 4 comments
Labels
backend bug Something isn't working

Comments

@oliverbooth
Copy link

describe the bug
when navigating to the raw dump of a paste (https://paste.myst.rs/raw/*/*), the provided result is given with header text/html and when copied, every line is separated by an additional blank line that shouldn't exist in the actual text.

to reproduce
steps to reproduce the behavior:

  1. view a paste
  2. click "raw"
  3. copy the text
  4. paste in notepad or any text editor to view it

expected behavior
copying the text should omit blank lines. ideally, when viewing the raw of a paste, the server should respond with content-type text/plain, and just dump the contents of the paste as it is in plain text.

screenshots
n/a

device and browser:
(though this is irrelevant)

  • os: windows
  • browser: firefox
  • browser version: 116.0.1

additional context
n/a

@CodeMyst
Copy link
Owner

hmm, i can't seem to reproduce this behaviour, both on chrome and firefox copying the raw contents works as expected.

doesn't matter that the result is text/html since the code is wrapped in a pre block.

@oliverbooth
Copy link
Author

I recorded a clip to show the behaviour: https://streamable.com/ku0u5k

@oliverbooth
Copy link
Author

oliverbooth commented Aug 10, 2023

I believe this may be because the paste in question uses crlf not lf terminator because I pasted from Windows. If I view source of the raw dump, it starts out:

<code><pre>using System.Text;&#13;&#10;&#13;&#10;const string stringToConvert = "🜊";&#13;&#10;ReadOnlySpan

So I think &#13;&#10; is being treated as "two new lines". I guess a workaround to this if you don't want to send as text/plain would be to just replace crlf with lf when dumping raw

@CodeMyst
Copy link
Owner

Ahh that could be it. Since I convert all line endings to unix ones.

@CodeMyst CodeMyst added bug Something isn't working backend labels Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants