Install
Works with Drupal: ^10.3 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
256.92 KB
MD5: b655f8808bc39dda7a774f9eee9a4826
SHA-1: 3e138d82e54184b10c52a77854302ede1c2710b6
SHA-256: 022da8da5b8dbd48b90f6df24010c9bc4c868d33c52464ceb1db3c91a243778b
Download zip
329.83 KB
MD5: d0409a2142cfef0deb7a7896751dab4c
SHA-1: e8bc7ef8400fcb74a70a8f0f8778f448bfd9cc23
SHA-256: fa4c03ebd333b02ea1accc645c0fa8fa111aae8f80d9af7eff6b9fd479f539cd
Release notes
Second beta of Short URL 2.0. It comes from three release audits and a performance audit of 2.x: it closes three node access holes, makes cached redirects about a third faster, and changes a few behaviours and APIs, listed below.
Upgrade
- Drupal 10.3 or later is required (10.2 is no longer supported); Drupal 11 is supported.
- Run
drush updatedb: one update hook adds the visit date column and fills it from the existing visits, in batches; seven post-updates adjust the shipped views, the short URL form display and existing short URLs (the new redirect status field, internal paths imported without a leading slash, the listing's unpublished filter). - If you use Domain Short URL, update it at the same time: its CSV domain column now plugs into Short URL's import through the new column extension point, and it requires this release.
- If you use Piano Analytics Short URL, update Piano Analytics too (2.x, #3610324): Short URL now records visits after the response is sent, and older Piano Analytics releases only sent their queued events on
kernel.terminate, which never fires for pages served from the page cache.
Security
Betas are not covered by security advisories, so these fixes are listed here:
- #3602994 The QR code and expand endpoints served an unpublished short URL's QR code and destination to users who cannot view it; the short URL listing showed other users' unpublished short URLs; the CSV import created short URLs without create access and changed short URLs the importer could not edit.
- #3602991 The
db-statsendpoint needed only the API permission; REST and JSON:API accepted a slug mode the user may not use; editing a short URL could change its mode and slug; a save could replace a generated slug; the Chart.js files loaded from a CDN had no integrity check. - #3602969 Every statistics route now checks node access and the statistics permissions.
- #3602970 Slugs and destinations are validated on the entity, and a slug can no longer shadow a site path.
- #3602971 The visitor's IP is stored as a hash keyed with the site's hash salt (visits recorded before the update keep their old hash).
Behaviour changes
drush shorturl:importrequires--user, the account the import runs as (#3602992).- A CSV import needs Short URL: Create new content to create short URLs, and edit access to each short URL it updates (#3602994).
- The QR code and expand endpoints answer 404 for a short URL the user cannot view; the listing hides other users' unpublished short URLs (#3602994).
- Deleting a short URL deletes its visits (#3602995).
- The no-store setting is honoured: with it off, redirects no longer send
Cache-Control: no-store(#3602971). Settings overrides insettings.phpnow apply to visit tracking (#3602992). - The statistics page and the short URL display follow the admin theme's colors, dark mode included (#3602997); short URL pages can use the administration theme (#3602986).
New features
- Each short URL can choose its redirect status code (#3602977).
- Modules can add CSV import columns through
ShortUrlCsvColumnInterface(tagshorturl.csv_column) (#3602990).
Performance
- Cached short URL redirects answer about 32% faster: the visit (country lookup, event, database row) is now recorded after the response is sent, on PHP-FPM after the connection is closed (#3602998).
- The auto-increment counter no longer scans every numeric slug for each new number, and the retention purge deletes old visits in batches (#3602992).
API changes
ShortUrlVisitMiddlewarerecords visits indestruct(): code calling itshandle()directly, such as a test, must calldestruct()for the visit to be recorded;ShortUrlVisitEventsubscribers run after the response is sent.VisitTrackerInterfacegainsdeleteVisits(): a custom implementation must add it (subclasses ofVisitTrackerinherit it).ShortUrlCsvValidationResult::totalValid(),totalErrors(),totalCreates()andtotalUpdates()are deprecated forcountValidRows(),countRowsWithErrors(),countRowsToCreate()andcountRowsToUpdate(), and removed in 3.0.0.
All changes since 2.0.0-beta1
Bug fixes
- #3602969 Check node access and the statistics permissions on every statistics route
- #3602970 Validate short URL slugs and destinations on the entity and stop slugs from shadowing site paths
- #3602971 Honour the no_store setting and store a keyed hash of the visitor IP
- #3602972 Compute visit statistics portably in the site timezone and keep the visits report and short URLs correctly cached
- #3602973 Store CSV-imported internal paths as valid links and read CSV files that start with a byte order mark
- #3602974 Make the short URL display and the statistics page accessible and translatable
- #3602978 Keep a short URL's label and language when an import updates it from a row without them
- #3602979 Update core in the Tugboat build so previews survive a core security release
- #3602982 Update Drupal core when the Tugboat base preview is built
- #3602984 Stop the Tugboat preview failing for logged-in users since Smart IP was added
- #3602985 Record the visitor's country for short URL visits served from the page cache
- #3602989 Hide the URL redirects box on saved form displays, theme revision pages and fix the import preview
- #3602991 Apply Short URL's access rules at every door
- #3602992 Fix the drush import, concurrent auto-increment numbers and the visit tracking settings override
- #3602994 Apply node access to the QR, expand and listing views of a short URL, and to the CSV import
- #3602995 Delete a short URL's visits with it
- #3602997 Let the statistics page and the short URL display follow the admin theme's colours
New features
- #3602977 Let each short URL choose its redirect status code
- #3602986 Show short URL pages in the administration theme
Tasks
- #3602975 Raise PHPStan to level 5 and ship the module's own configuration
- #3602980 Open the Tugboat preview on a guide to the module
- #3602981 Show the short URL listing's own short URLs as paths
- #3602983 Record the visitor's country on the Tugboat preview
- #3602987 Hide the menu and URL redirect boxes on the short URL form
- #3602988 Open QR code images in the browser instead of downloading them
- #3602990 Let modules add CSV import columns, and move the domain column to Domain Short URL
- #3602993 Translate the statistics device labels and the import preview, and correct the documentation
- #3602996 Name the import validation counters with a verb
- #3602998 Record short URL visits after the redirect is sent