[MGNLRES-52] Allow loading of resources from arbitrary path Created: 19/Oct/12  Updated: 29/Mar/22  Resolved: 04/Dec/12

Status: Closed
Project: Magnolia Resources Module
Component/s: None
Affects Version/s: 1.4.2, 1.5
Fix Version/s: 1.4.3, 1.5.5

Type: New Feature Priority: Neutral
Reporter: Milan Divilek Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to DOCU-349 Update documentation - resources module Closed
Template:
Acceptance criteria:
Empty
Date of First Response:
Team: Nucleus

 Description   

Provide way for loading of regular resources (not processed resources) from arbitrary path in same manner as FM FileTemplateLoader does.



 Comments   
Comment by Jan Haderka [ 27/Nov/12 ]

While the implemented solution works and there is nothing wrong with it, grouping multiple paths under same loader makes configuration different from other parts of Magnolia and less flexible. Suppose I want to look at some place in filesystem first (my <webapp_root>/resources folder), then classpath and only then to some {{/backup/resources} folder. I can still achieve it w/ current config, but it would be easier to read if each file system loader allowed only one path. Nothing stops me from still configuring multiple ones and then enabling/disabling them as I wish.

Comment by Jan Haderka [ 03/Dec/12 ]
+        if (StringUtils.startsWith(template.getCanonicalPath(), path)) {

Could you please add comment to it explaining that this check is necessary to make sure no one can escape base path? Otherwise someone will remove it at some point in the future while trying to "optimize" the code

Generated at Mon Feb 12 06:46:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.