Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A AndroidAsync
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 333
    • Issues 333
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Koushik Dutta
  • AndroidAsync
  • Merge requests
  • !264

asyncHttpServer.directory fix. replaceAll replaces the entire url pattern.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/nutsiepully/pattern_fix into master Oct 18, 2014
  • Overview 6
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: nutsiepully

Currently the code in asyncHttpServer works as follows.

  1. It uses pattern.matches() to verify whether a match has been found in the URL. This needs to match the entire string else the match doesn't succeed.
  2. To extract the path, the directory function replaces the entire match with "".

So for example, if I need to match URLs with the pattern "/files/.*", the match succeeds, but the replaceAll("") converts the entire match to "". Thus for "/files/myfile", the path ends up as "" and doesn't work. If I simply use "/files/", the pattern.matches() fails since it'd doesn't match the entire string.

I have modified the code to do the following - Pattern matches the entire string but detects the path as the substring after the first group.

So "(/files/).*" matches "/files/myfile", but replaces it with "myfile".

Please let me know if this seems right. Thanks a lot for the great library.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/nutsiepully/pattern_fix