mattermost/server/channels/utils
Alejandro García Montoro d81ce03168
MM-57839: Rewrite static assets only if needed (#27076)
* Rewrite static assets only if needed

Refactor UpdateAssetsSubpathInDir so that the actual rewriting of files
happen in two different functions: one for root.html, another for
manifest.json and *.css files.

I would have wanted to simply do a

  if pathToReplace == newPath { return nil }

when those two variables are defined, but the logic for root.html is not
that simple, and that may miss some edge cases, so I opted out for
simply moving the actual rewriting to individual functions, which check
for their corresponding conditions to perform the update:
  1. for root.html, check that the edited file is indeed different than
     the original one
  2. for manifest.json and *.css files, rewrite them only if
     pathToReplace != newPath, which in this case is clear that that's the
     only modification we do

* Fix expected error msg in test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-13 12:01:57 +02:00
..
fileutils Centralize the GetPackagePath (#27004) 2024-05-15 12:05:13 -03:00
imgutils MM-53032: Fix module path after repo rename (#23689) 2023-06-11 10:54:35 +05:30
mocks MM-57759: Added mockery support for 1.22 (#26774) 2024-04-13 08:15:59 +05:30
testutils MM-58275 Ensure image proxy site URL is updated when that changes (#27214) 2024-06-04 14:06:37 -04:00
api.go [MM-57356] Make use of go1.21 features (#26620) 2024-04-04 13:44:03 +02:00
api_test.go MM-53032: Fix module path after repo rename (#23689) 2023-06-11 10:54:35 +05:30
archive.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
archive_test.go MM-53032: Fix module path after repo rename (#23689) 2023-06-11 10:54:35 +05:30
backoff.go Rebuild channel index (#26080) 2024-03-13 10:26:06 +05:30
backoff_test.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
emoji.go [MM-29240] Improve buffer handling of UploadEmojiImage (#25536) 2023-12-19 10:00:01 +01:00
file.go fixed initialism errors in accordance with golang conventions in 7 files. (#24287) 2023-08-22 10:15:51 +03:00
file_test.go fixed initialism errors in accordance with golang conventions in 7 files. (#24287) 2023-08-22 10:15:51 +03:00
hash.go Applies perfsprint linter (#24999) 2023-11-03 11:18:18 +01:00
humanize.go MM-57378: Bump up golangci version (#26535) 2024-03-22 10:23:21 +05:30
i18n.go Eliminate MM_SERVER_PATH (#24968) 2024-05-10 18:13:05 -03:00
license-public-key-test.txt update test public key (#22835) 2023-04-28 09:20:12 -05:00
license-public-key.txt Undo accidental merge (#22848) 2023-04-05 11:24:32 -04:00
license.go [MM-56653] Improve license loading errors (#26050) 2024-04-05 16:59:19 +02:00
license_public_key.go Service environment (#23443) 2023-06-07 10:15:33 -03:00
license_test.go [MM-56653] Improve license loading errors (#26050) 2024-04-05 16:59:19 +02:00
markdown.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
markdown_test.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
merge.go Add whitespace linter (#24855) 2023-10-11 10:13:36 +02:00
merge_test.go Add whitespace linter (#24855) 2023-10-11 10:13:36 +02:00
policies-roles-mapping.json Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
random.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
subpath.go MM-57839: Rewrite static assets only if needed (#27076) 2024-06-13 12:01:57 +02:00
subpath_test.go MM-57839: Rewrite static assets only if needed (#27076) 2024-06-13 12:01:57 +02:00
textgeneration.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
time.go Set batched notification email timestamps to user TZ (#26121) 2024-02-29 12:42:34 +01:00
time_test.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
urlencode.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
urlencode_test.go Add whitespace linter (#24855) 2023-10-11 10:13:36 +02:00
utils.go [MM-57356] Make use of go1.21 features (#26620) 2024-04-04 13:44:03 +02:00
utils_test.go MM-54182 - add correct information to session table from mobile devices (#24353) 2023-09-01 14:25:07 +02:00