Blank site name and missing theme logo give a bad manifest text and a broken logo image

Part of #3596034 (closed).

Problem/Motivation

  1. With "Site/Org Name" blank the config holds an empty string, so the ?? fallback to the system site name never applies. Found in C2paSignSubscriber.php and twice in c2pa_sign.module.
  2. When the theme has no logo, c2pa_sign_get_logo() returns an empty URL for the form and the docroot directory as the icon file. c2patool then fails with resource not found: /var/www/html/web, on every version from 0.9.12 to 0.28.2.
  3. With "Claim generator" blank, claim_generator_info is an empty array. c2patool 0.10.2 and 0.20.0 panic on it (index out of bounds), and PHP warns "Undefined array key 0".

Steps to reproduce

  1. Leave "Site/Org Name" and "Claim generator" blank, clear the logo setting and use a theme without a logo.

  2. Upload an image. Signing fails with resource not found.

  3. Set a logo, derive an image and read it with c2patool. The assertion says:

    "generation": "Image derivative generated for file rich.jpg in style E2E meta jpg at site ."
  4. Open /admin/config/media/c2pa_sign. The logo preview is broken:

    <img width="50px" src="http://example.com/">

Seen with 1.4.11 and 1.x, c2patool 0.9.12 to 0.28.2, Drupal 11.4.

Proposed resolution

  • Fall back on empty values too.
  • Add the icon and the preview only when a logo file exists.
  • Always write one claim_generator_info entry, named after the claim generator, then the site name, then "Drupal".

Definition of done

  • Blank "Site/Org Name" gives the system site name in every assertion
  • Blank "Claim generator" gives exactly one claim_generator_info entry, with no PHP warning
  • No logo gives no icon in the manifest, no preview in the form, and signing succeeds
  • Kernel test for the three cases, run by CI

Testing instructions

  1. Repeat the steps above with c2patool 0.27.x or 0.28.x. Signing succeeds.
  2. c2patool file.jpg shows claim_generator_info[0].name equal to the site name and no icon.
  3. /admin/reports/dblog has no "Undefined array key" entry.
  4. The settings form has no <img> under the logo field.

AI Compliance

🤖 Generated with the help of an LLM, reviewed and approved by me before posting.

Edited by Giorgio Alfredo Pagano