File tree 2 files changed +16
-4
lines changed
2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -672,8 +672,16 @@ def to_python(self, value):
672
672
"""Convert a text area into a list of items (one per line)."""
673
673
if not value :
674
674
return []
675
- # Sanitize lines removing trailing spaces and skipping empty lines
676
- return [line .strip () for line in value .splitlines () if line .strip ()]
675
+ # Normalize paths and filter empty lines:
676
+ # - remove trailing spaces
677
+ # - skip empty lines
678
+ # - remove starting `/`
679
+ result = []
680
+ for line in value .splitlines ():
681
+ normalized = line .strip ().lstrip ("/" )
682
+ if normalized :
683
+ result .append (normalized )
684
+ return result
677
685
678
686
def prepare_value (self , value ):
679
687
"""Convert a list of items into a text area (one per line)."""
Original file line number Diff line number Diff line change @@ -1181,7 +1181,7 @@ def test_addonsconfig_form(self):
1181
1181
"doc_diff_enabled" : False ,
1182
1182
"filetreediff_enabled" : True ,
1183
1183
# Empty lines, lines with trailing spaces or lines full of spaces are ignored
1184
- "filetreediff_ignored_files" : "user/index.html\n \n \n \n changelog.html \n " ,
1184
+ "filetreediff_ignored_files" : "user/index.html\n \n \n \n changelog.html \n /normalized.html " ,
1185
1185
"flyout_enabled" : True ,
1186
1186
"flyout_sorting" : ADDONS_FLYOUT_SORTING_CALVER ,
1187
1187
"flyout_sorting_latest_stable_at_beginning" : True ,
@@ -1206,7 +1206,11 @@ def test_addonsconfig_form(self):
1206
1206
self .assertEqual (self .project .addons .filetreediff_enabled , True )
1207
1207
self .assertEqual (
1208
1208
self .project .addons .filetreediff_ignored_files ,
1209
- ["user/index.html" , "changelog.html" ],
1209
+ [
1210
+ "user/index.html" ,
1211
+ "changelog.html" ,
1212
+ "normalized.html" ,
1213
+ ],
1210
1214
)
1211
1215
self .assertEqual (self .project .addons .notifications_enabled , True )
1212
1216
self .assertEqual (self .project .addons .notifications_show_on_latest , True )
You can’t perform that action at this time.
0 commit comments