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

escape # in encoder so #{ can't happen in resulting string #14

Closed
wants to merge 1 commit into from

Conversation

repomaa
Copy link

@repomaa repomaa commented Jan 18, 2018

No description provided.

Copy link
Collaborator

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Seems like I really missed out on interpolation when setting up the escaping. 😅

@@ -69,7 +69,7 @@ module BakedFileSystem
def write(slice : Bytes)
slice.each do |byte|
case byte
when 35_u8..91_u8, 93_u8..127_u8
when 36_u8..91_u8, 93_u8..127_u8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add when 35_u8; @io << "\\#"? That would result in a few bytes less in the baked string.

@@ -0,0 +1 @@
L#9U"gAc-XLA*/Ac|1M:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a description for this file's purpose so it doesn't get lost?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can't modify the file without messing up the test. I named the folder to give hints on what it's for. Further explanation in the test.

@straight-shoota
Copy link
Collaborator

Would you mind also adding a spec for BakedFileSystem::Loader::Encoder like this?

describe "Loader::Encoder" do
  it "escapes string interpolation" do
    String.build do |str|
      Encoder.new(str) << "foo\#{bar}"
    end.should eq "foo\\\#{bar} "
  end
end

@straight-shoota
Copy link
Collaborator

@jreinert Are you still up for this?

@straight-shoota
Copy link
Collaborator

This was superseeded by #15
Thanks @jreinert for setting the basis for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants