Ktt-Development/simplehttpserver

Using a FileNameAdapter causes ByteLoadingOption.LIVELOAD to not work properly on add directory

Katsute opened this issue · 1 comments

Prerequisites

If all checks are not passed then the issue will be closed

  • I have checked that no other similar issue already exists

Operating System: Operating system name and version
Windows 10

Release Version: Release version or branch where the issue occurred
03.05.02

Issue

Explain your issue. Add any screenshots here
Using name adapter with liveload causes server to look for file at the adapted name instead of the unadapted name.

Expected Behavior

Explain what was supposed to happen
Server should look for file at non adapted name.

Steps To Reproduce

Explain how and/or when the error occurred
Use name adapter with liveload.

Suggested Fix

When using liveload get the folder that the file is in and for each of the children run the adapter to see which file would adapt to the requested name.

Cause of issue is that for live load server is using the relative (adapted name) for the file.

return pabs.equals(dabs) || (isWalkthrough && pabs.startsWith(dabs)) ? new File(dabs + relative) : null;

Instead server should construct a new file with the base folder name and adapt each file name in the folder until you get a match.

Test cases are missing for adapted names in add directory