Skip to content

Commit 0700fc2

Browse files
committed
Fix duplicate deploy cache rows
The deploy cache could contain rows for the page at e.g. /zzz/ and /zzz/index.html. Running a normal workflow results in an index.html being written to disk and a cache key with index.html, but running direct-deploy skips this and results in the dir-only path. Fix by adding index.html in the deploy step when the path ends in /.
1 parent 29463c8 commit 0700fc2

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- Fix location in crawler redirect debug message.
1414
- Add more debug messages to crawler.
1515
- Show data hashes and deployed at datetimes on deploy cache pages.
16+
- Fix an issue where the deploy cache could contain duplicate rows
17+
for the same path.
1618

1719
## 9.8.0 (2026-01-07)
1820

src/S3/Deployer.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ public function uploadFilesIter( \Iterator $path_infos ): void {
103103
$redirect_to = $path_info->redirect_to;
104104
$status = $path_info->status;
105105

106+
if ( mb_substr( $cache_key, -1 ) === '/' ) {
107+
$cache_key .= 'index.html';
108+
}
109+
110+
$s3_key = $s3_prefix . ltrim( $cache_key, '/' );
111+
106112
if ( ! $body && $filename ) {
107113
$real_filepath = realpath( $filename );
108114

@@ -127,11 +133,6 @@ public function uploadFilesIter( \Iterator $path_infos ): void {
127133
}
128134
}
129135

130-
$s3_key = $s3_prefix . ltrim( $cache_key, '/' );
131-
if ( mb_substr( $cache_key, -1 ) === '/' ) {
132-
$s3_key .= 'index.html';
133-
}
134-
135136
if ( $status === 404 ) {
136137
$cmd_name = 'DeleteObject';
137138
$cmd_data = [

0 commit comments

Comments
 (0)