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

Radix doesn't recognice path with "s" at end #21

Closed
faustinoaq opened this issue Mar 11, 2017 · 2 comments
Closed

Radix doesn't recognice path with "s" at end #21

faustinoaq opened this issue Mar 11, 2017 · 2 comments

Comments

@faustinoaq
Copy link

Based on @msa7 message on Gitter

Radix version: 0.37
Crystal version: 21.1 Linux x86_64

require "radix"

tree = Radix::Tree(Symbol).new
tree.add "/products", :products
tree.add "/product/new", :product_new

result = tree.find "/products"

if result.found?
  puts result.payload
else
  puts "Not found"
end

# => Not found
@faustinoaq faustinoaq changed the title Radix don't recognice path with "s" at end Radix doesn't recognice path with "s" at end Mar 11, 2017
@luislavena
Copy link
Owner

Thank you @faustinoaq for the report. ❤️ ❤️ ❤️

Will look into this over the weekend.

Cheers.

luislavena added a commit that referenced this issue Mar 12, 2017
Given the following nodes in a tree:

    # ( 8) /product
    # ( 4)         /new
    # ( 1)         s
    tree = Radix::Tree(Symbol).new
    tree.add "/products", :products
    tree.add "/product/new", :product_new

It failed to properly identify `/products` during lookup:

    result = tree.find "/products"
    result.found? # => false

Caused by incorrect comparsion of `s` remaining path against `/new`
node instead of continue comparison with the next one.

Fixes #21
@luislavena
Copy link
Owner

Hello @faustinoaq, I've just merged #22 that corrects this issue.

Will wrap that and other changes and perform a new release of Radix shortly.

Thank you for your report and your help making Radix better! ❤️ ❤️ ❤️

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

No branches or pull requests

2 participants