PerlDancer / PerlDancer/Dancer2

FileUtils::escape_filename mishandles a filename of '0'

Open Beginner friendly
#1,816 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Perl
Stars
604
Forks
288
Avg merge
1d 5h
Merged PRs (30d)
5

Description

Status: reasoned from code

lib/Dancer2/FileUtils.pm:67:

my $filename = shift or return;

Returns empty for any falsy-but-valid name — "0" or "".

Not reachable from session IDs (encode_base64url(pack("N6",...)) always yields 32 characters), but this is a published utility in a package called FileUtils, so callers may reasonably pass "0".

Suggested fix

my $filename = shift;
return unless defined $filename && length $filename;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/Dancer2/FileUtils.pm at line 67 and trace how escape_filename handles its argument. Confirm that the utility preserves the valid filename "0" while still treating an empty name as empty, then verify the relevant test coverage or add a regression check if the existing tests do not cover this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.