Review main Merged

92678[FEATURE] Add "Short URLs" module

Marno Schmigotzki CR +2 V +2 Expert +1758 −12 updated 03/04/26, 19:13

Commit message

A new backend submodule "Short URLs" is added to the
"Link Management" area.

The new module allows to manage short URLs. Short URLs
can be generated automatically or created manually, while
always refering to a defined target. The Short URL cannot
be changed after it has been created, but the target can
be adjusted at any time.

The short URLs can be copied to the clipboard via
the list view and the edit view.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Oli Bartsch +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Oli Bartsch +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 29

Show 9 more files

Review log 4560

Show 2635 earlier messages
  1. Marno Schmigotzki uploaded patch set 1 02/05/26, 10:01

  2. core-ci voted on patch set 1 V -1 02/05/26, 10:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95123

  3. Marno Schmigotzki uploaded patch set 2 V -1 02/05/26, 10:15

  4. core-ci voted on patch set 2 V -1 02/05/26, 10:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95127

  5. Simon Schaufelberger commented on patch set 2 02/05/26, 10:42

    typo3-short-url.scss:2

    why is this important?

    short-url-generator.ts:56

    No short URL

    link_management.xlf:10

    no dot at the end?

    ShortUrlGeneratorController.php:48

    don't mix private and protected. either make everything in the whole class protected including the services in the constructor or everything private as extending this class should not happen.

    ShortUrlGeneratorController.php:63

    The only reason this method could potentially be xclassed is to change this value. Just an idea, maybe introduce a page tsconfig setting for this?

    ShortUrlNewDocHeaderButton.php:76

    i would make these methods private as event listeners should not be overwritten

    HandleNewShortUrlRecord.php:39

    can be removed

    HandleNewShortUrlRecord.php:41

    can be private -> final class

    HandleNewShortUrlRecord.php:49

    can we add data types for incomingFieldArray, table and id? Id is probably string|int

    HandleNewShortUrlRecord.php:60

    must we use integers here or can we also use booleans?

    short_urls.xlf:13

    use "short" globally?

    locallang_module_redirect.xlf:97

    short
  6. Marno Schmigotzki uploaded patch set 3 V -1 02/05/26, 10:49

  7. core-ci voted on patch set 3 V -1 02/05/26, 10:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95129

  8. Marno Schmigotzki uploaded patch set 4 V -1 02/05/26, 11:49

  9. Marno Schmigotzki commented on patch set 3 02/05/26, 11:50

    typo3-short-url.scss:2 Reply

    Done

    link_management.xlf:10 Reply

    Done

    ShortUrlGeneratorController.php:48 Reply

    Done

    ShortUrlNewDocHeaderButton.php:76 Reply

    Done

    HandleNewShortUrlRecord.php:39 Reply

    Done

    HandleNewShortUrlRecord.php:41 Reply

    Done

    HandleNewShortUrlRecord.php:49 Reply

    Done

    HandleNewShortUrlRecord.php:60 Reply

    Done
  10. core-ci voted on patch set 4 V -1 02/05/26, 11:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95140

  11. Marno Schmigotzki commented on patch set 4 02/05/26, 12:30

    short-url-generator.ts:56 Reply

    It's a proper noun, so I would leave it as it is.

    ShortUrlGeneratorController.php:63 Reply

    We can implement that in the future. The editor can freely edit the Short URL when creating it.

    short_urls.xlf:13 Reply

    It's a proper noun, so I would leave it as it is.

    locallang_module_redirect.xlf:97 Reply

    It's a proper noun, so I would leave it as it is.
  12. Marno Schmigotzki commented on patch set 4 02/05/26, 12:30

    short-url-generator.ts:56 Reply

    It's a proper noun, so I would leave it as it is.
  13. Marno Schmigotzki uploaded patch set 5 V -1 02/05/26, 12:58

  14. core-ci voted on patch set 5 V -1 02/05/26, 13:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95144

  15. core-ci voted on patch set 5 V +1 02/05/26, 15:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95144

  16. Marno Schmigotzki commented on patch set 5 02/05/26, 16:53

    TODO: Backend module icon and mobile optimization
  17. Daniel Windloff commented on patch set 5 02/05/26, 17:09

    HandleNewShortUrlRecord.php:67

    Perhaps make the value unique at this point so that it can definitely be saved and inform the user about the change.

    Overview.fluid.html:217

    I would move that icon to the first position. Then it is consistent with the QR code overview.
  18. Daniel Windloff commented on patch set 5 02/05/26, 17:25

    ShortUrlGeneratorController.php:60

    Perhaps avoid 0,1,i,l,O as the difference between the letters might be hard to get (depending on the font)
  19. Marno Schmigotzki uploaded patch set 6 V +1 02/05/26, 17:30

  20. Marno Schmigotzki commented on patch set 6 02/05/26, 17:35

    ShortUrlGeneratorController.php:60 Reply

    Unfortunately TYPO3\CMS\Core\Crypto\Random does not support this which makes the implementation more complex

    HandleNewShortUrlRecord.php:67 Reply

    That would be an idea, but the editor would not be able to change the generated URL.

    Overview.fluid.html:217 Reply

    Done
  21. core-ci voted on patch set 6 V +1 02/05/26, 18:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95193

  22. Daniel Windloff commented on patch set 6 02/05/26, 18:22

    ShortUrlGeneratorController.php:60 Reply

    As I see no need for crypo random for a public short url, something like `substr(str_shuffle('23456789ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz'),1,8)` could be possible.
  23. Bastien Lutz voted on patch set 6 CR +1 02/05/26, 18:24

  24. Marno Schmigotzki uploaded patch set 7 CR +1 V +1 02/05/26, 20:34

  25. Marno Schmigotzki commented on patch set 7 02/05/26, 20:35

    ShortUrlGeneratorController.php:60 Reply

    Right, I changed this!
  26. core-ci voted on patch set 7 V -1 02/05/26, 20:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95211

  27. Daniel Windloff voted on patch set 7 CR +1 V +1 02/05/26, 20:42

  28. Marno Schmigotzki uploaded patch set 8 CR +1 V +1 02/05/26, 20:46

  29. Daniel Windloff voted on patch set 8 CR +1 V +1 02/05/26, 20:47

  30. core-ci voted on patch set 8 V +1 02/05/26, 20:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95212

  31. Oli Bartsch commented on patch set 8 V -1 02/05/26, 21:26

    Let me review this.
  32. Garvin Hicking commented on patch set 8 02/05/26, 22:00

    ShortUrlNewDocHeaderButtonEventListener.php:72

    I have not checked the other listeners, vut is this numerical access to the array the best way to override buttons? That sounds like asking for trouble with other event listeners...?

    ShortUrlElement.php:93

    ```suggestion 'redirects.module_redirect:short_url.copy' ```

    ShortUrlGenerator.php:41

    Can we use short translation syntax here?

    HandleNewShortUrlRecord.php:72

    Please use short domain synrax here too

    sys_redirect.php:5

    Can we use the short syntax here?

    Overview.fluid.html:70

    Please use translation domain here

    Overview.fluid.html:75

    And here and following places too

    Overview.fluid.html:435

    This is probably a lot of copy&paste from the other modules, maybe a chance to use universial partials or even a fluid component for abstraction, and avoid redundancy?
  33. Marno Schmigotzki commented on patch set 8 02/06/26, 09:08

    On it
  34. Marno Schmigotzki uploaded patch set 9 CR +1 V +1 02/06/26, 10:26

  35. Marno Schmigotzki commented on patch set 9 02/06/26, 10:27

    ShortUrlElement.php:93 Reply

    Done

    ShortUrlGenerator.php:41 Reply

    Done

    HandleNewShortUrlRecord.php:72 Reply

    Done

    sys_redirect.php:5 Reply

    Done

    Overview.fluid.html:70 Reply

    Done

    Overview.fluid.html:75 Reply

    Done
  1. Marno Schmigotzki commented on patch set 9 02/06/26, 10:34

    ShortUrlNewDocHeaderButtonEventListener.php:72 Reply

    Currently, this seems to be the only option when looking at TYPO3\CMS\Backend\Template\Components\ModifyButtonBarEvent
  2. Marno Schmigotzki commented on patch set 9 02/06/26, 10:37

    HandleNewShortUrlRecord.php:67 Reply

    As discussed we try to fix it without a workaround.
  3. core-ci voted on patch set 9 V +1 02/06/26, 10:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95260

  4. Simon Schaufelberger commented on patch set 9 02/06/26, 10:43

    Overview.fluid.html:62

    wrap the f:comment around a real html comment <!-- xxx -->
  5. Marno Schmigotzki commented on patch set 9 02/06/26, 10:55

    Overview.fluid.html:62 Reply

    I see your point, perhaps it is more of an optimization of all redirect module templates in the future.
  6. Marno Schmigotzki commented on patch set 9 02/06/26, 10:55

    Reply

    Done
  7. Marno Schmigotzki uploaded patch set 10 V +1 02/06/26, 11:11

  8. core-ci voted on patch set 10 V +1 02/06/26, 11:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95267

  9. Guido Schmechel commented on patch set 10 02/07/26, 11:31

    Note 1: I have created a redirect (301) and a short URL (307). The redirect is set to “*” in source_host and the short URL to “t3main.ddev.site”. As a result, the isUniqueShortUrl function in HandleNewShortUrlRecord does not apply and the duplicate is not found. Note 2: When a duplicate short URL is successfully found, I am redirected to the New Record view of the sys_redirect table.
  10. Guido Schmechel commented on patch set 10 02/07/26, 11:33

    Note 3: Similarly, I would now expect the redirect to include a duplicate check during creation. This may not be part of the patch and is more of a follow-up.
  11. Guido Schmechel commented on patch set 10 02/07/26, 11:42

    In general, please check the status of the editor role, which is only permitted to read sys_redirects.

    ShortUrlModuleController.php:70

    if (!$this->canListRedirects()) { return $view->renderResponse('ShortUrl/Overview'); } Similar to redirects, we need access to the sys_redirect table.
  12. Simon Schaufelberger uploaded patch set 11 V +1 02/17/26, 22:41

  13. core-ci voted on patch set 11 V +1 02/17/26, 22:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96084

  14. Oli Bartsch uploaded patch set 12 V +1 03/03/26, 13:28

  15. core-ci voted on patch set 12 V +1 03/03/26, 13:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97183

  16. Georg Ringer commented on patch set 12 CR -1 03/03/26, 16:10

    if the shorturl exists already, the form is reloaded but now all fields are visible of sys_redirect, not only the ones of short urls
  17. Oli Bartsch commented on patch set 12 03/03/26, 16:16

    Reply

    Yes, we are aware of this, currently working on it.
  18. Oli Bartsch uploaded patch set 13 CR -1 V +1 03/03/26, 21:57

  19. core-ci voted on patch set 13 V +1 03/03/26, 22:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97230

  20. Oli Bartsch uploaded patch set 14 V +1 03/03/26, 23:20

  21. core-ci voted on patch set 14 V +1 03/03/26, 23:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97235

  22. Oli Bartsch commented on patch set 14 CR +1 V +1 03/03/26, 23:33

    Reply

    Done

    Reply

    Done

    ShortUrlModuleController.php:70 Reply

    Done

    Overview.fluid.html:435 Reply

    I would like to do this separately. Those templates are kind of mess and need some love anyways.
  23. Simon Schaufelberger voted on patch set 14 CR +1 V +1 03/04/26, 00:14

  24. Georg Ringer voted on patch set 14 CR +2 V +2 03/04/26, 19:13

  25. Georg Ringer merged patch set 15 03/04/26, 19:13