1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Composing a custom project picture: Remove misaligned empty icon

Summary:
Do not assume that all items under `/resources/builtin/projects/` are image files (some can be subdirectories). Only add PNG files to the map.

Could be nicer to use `is_file()` or `is_dir()` but we are dealing only with string representations of files and folders.

Closes T15696

Test Plan: Go to `/project/picture/1/` and click the `Choose Icon and Color...` button; check last icon shown under "Choose Icon".

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15696

Differential Revision: https://we.phorge.it/D25499
This commit is contained in:
Andre Klapper 2023-12-27 17:38:40 +01:00
parent 2d997c3f10
commit 428f9686c4

View file

@ -51,12 +51,14 @@ final class PhabricatorFilesComposeIconBuiltinFile
$map = array();
$list = Filesystem::listDirectory($root, $include_hidden = false);
foreach ($list as $file) {
$short = preg_replace('/\.png$/', '', $file);
$map[$short] = array(
'path' => $root.$file,
'quip' => idx($quips, $short, $short),
);
$count = 0;
$short = preg_replace('/\.png$/', '', $file, -1, $count);
if ($count === 1) {
$map[$short] = array(
'path' => $root.$file,
'quip' => idx($quips, $short, $short),
);
}
}
return $map;