Skip to content

Commit ce461fe

Browse files
john-shafferTim Cooke
andauthored
Bug fix: use transformPath when deleting 404s. This way, when '/post' returns 404, we delete '/post/index.html'. Before, we wouldn't delete '/post' because it's a directory. (elementor#878)
Co-authored-by: Tim Cooke <[email protected]>
1 parent 4252fbb commit ce461fe

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- [#855](https://github.com/leonstafford/wp2static/issues/855): Allow setting options to empty values from the CLI. @john-shaffer
3030
- [#850](https://github.com/leonstafford/wp2static/issues/850): Fix to write content to disk, even for cache hits when "Use CrawlCache" is ON. @utchy
3131
- [#877](https://github.com/leonstafford/wp2static/issues/877): Detect from web UI was not adding any URLs. @timothylcooke
32+
- [#878](https://github.com/leonstafford/wp2static/issues/878): Fix deletion of old pages when crawl returns 404. @timothylcooke
3233

3334
## WP2Static 7.1.7 (2021-09-04)
3435

src/Crawler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ public function crawlSite( string $static_site_path ) : void {
161161
// both the crawled and the processed.
162162
array_map(
163163
function( $dir ) use ( $root_relative_path ) {
164-
$suffix = ltrim( $root_relative_path, '/' );
164+
$transformed_path = self::transformPath( $root_relative_path );
165+
$suffix = ltrim( $transformed_path, '/' );
165166
$full_path = trailingslashit( $dir ) . $suffix;
166167
if ( file_exists( $full_path ) && ! is_dir( $full_path ) ) {
167168
unlink( $full_path );

0 commit comments

Comments
 (0)