I found some occurrences where file path URL is prepared using the actual path of the file rather than the relative path. For e.g.
IMO the location URL of files should be prepared dynamically using relative paths and this can be achieved by using
FlexibleLocation.resolveLocation() method. This method covers all the scenarios and in future, if we want to change anything, then all we need is to update the method and all instances will be fixed.