spullara / spullara/mustache.java
PartialCode dir is looking for last hard-coded forward-slash in Windows OS
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2k
- Forks
- 281
- PR merge metrics
- No merged PRs in 30d
Description
At constructor of PartialCode.java, in line 23, the slash it looks for is hard-coded to be forward-slash (Used everywhere except Windows):
protected PartialCode(TemplateContext tc, DefaultMustacheFactory df, Mustache mustache, String type, String variable) {
super(tc, df, mustache, variable, type);
// Use the name of the parent to get the name of the partial
String file = tc.file();
int dotindex = file.lastIndexOf(".");
extension = dotindex == -1 ? "" : file.substring(dotindex);
int slashindex = file.lastIndexOf("/"); <------------------------------ line 23
dir = file.substring(0, slashindex + 1);
recrusionLimit = df.getRecursionLimit();
}
When running on Windows OS, the file's path is usually stored using back-slashes and .lastIndexOf("/") will fail to find the correct index.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open PartialCode.java and inspect the PartialCode constructor around line 23, starting with how tc.file() is parsed into the parent directory. Reproduce the issue with a Windows-style path and verify that the resulting directory is correct on both Windows and non-Windows paths; done means the relevant path separator is handled without breaking existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100