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

Fix File.join with separator path component #6328

Merged
merged 1 commit into from
Jul 4, 2018

Conversation

icyleaf
Copy link
Contributor

@icyleaf icyleaf commented Jul 4, 2018

Simliar #5915.

It throws an exception if only separator in the middle component, (for example File.join("foo", "/", "bar"))

Unhandled exception: Index out of bounds (IndexError)
  from Slice(UInt8)@Slice(T)#pointer<Int32>:Pointer(UInt8)
  from Slice(UInt8)@Slice(T)#copy_to<Pointer(UInt8), Int32>:Pointer(UInt8)
  from String::Builder#write<Slice(UInt8)>:Nil
  from File::join<Tuple(String, String, String)>:String
  from File::join<String, String, String>:String
  from __icr_exec__:String
  from __crystal_main
  from Crystal::main_user_code<Int32, Pointer(Pointer(UInt8))>:Nil
  from Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
  from main

@bcardiff
Copy link
Member

bcardiff commented Jul 4, 2018

Maybe we should wait on this after #5635 since the code is moving to other file.

@straight-shoota
Copy link
Member

This is already fixed in #5635, but it doesn't hurt to merge.

@RX14 RX14 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib labels Jul 4, 2018
@RX14 RX14 added this to the Next milestone Jul 4, 2018
@RX14 RX14 merged commit dd84ad0 into crystal-lang:master Jul 4, 2018
@asterite
Copy link
Member

asterite commented Jul 4, 2018

It would be really nice to add comments inside the implementation. It's becoming really obscure.

@icyleaf icyleaf deleted the fix-file-join-with-separator branch July 5, 2018 01:37
@RX14 RX14 modified the milestones: Next, 0.26.0 Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants