HomePhabricator

resourceloader: Avoid endless module_deps write for the same value

Description

resourceloader: Avoid endless module_deps write for the same value

Follows-up 047b60b96d (ref T111481).

The if-condition compared the expanded paths, not the relative paths.
This meant there were two conditions under which the code will perform
a useless write that inserts *literally* the exact same JSON value.

  1. The base directory ($IP) changes after a branch upgrade.
  2. Paths contain '../', '//' or other unnormalized paths.

The latter caused various Echo and ULS methods to keep writing the
same value because one of their images is referenced in CSS using
'../'. When inserted in the database as relative path and then
expanded again at run-time and compared to the input value, they
don't match ("$IP/foo/../bar.png" != "$IP/bar.png") and cause a write.

Bug: T158813
Change-Id: I223c232d3a8c4337d09ecf7ec6e5cd7cf7effbff

Details

Provenance
KrinkleAuthored on Feb 22 2017, 9:54 PM
aaronCommitted on Feb 22 2017, 10:32 PM
Parents
rMW4cb9c1a24bde: Merge "Add GENDER to rollback-success message"
Branches
Unknown
Tags
Unknown
ChangeId
I223c232d3a8c4337d09ecf7ec6e5cd7cf7effbff