Skip to content

Commit

Permalink
Ensure favicon.ico always exists (to satisfy eager clients) (#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra authored Jun 21, 2024
1 parent 4f4e092 commit 988bd75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 8 additions & 0 deletions betty/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@ async def _generate_static_public(
job_context=job_context,
)

# Ensure favicon.ico exists, otherwise servers of Betty sites would log
# many a 404 Not Found for it, because some clients eagerly try to see
# if it exists.
await app.assets.copy2(
Path("public") / "static" / "betty.ico",
app.project.configuration.www_directory_path / "favicon.ico",
)


async def _generate_entity_type_list_html(
job_context: GenerationContext,
Expand Down
4 changes: 0 additions & 4 deletions playwright/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ class Server implements Disposable {
}

private async prepareFile (urlPath: string): Promise<ServerResponseMeta> {
// @todo Remove this favicon workaround. See https://github.com/bartfeenstra/betty/issues/1404.
if (urlPath === '/favicon.ico') {
urlPath = '/betty.ico'
}
const urlPathComponents = [this.wwwDirectoryPath, urlPath]
if (urlPath.endsWith('/')) {
urlPathComponents.push('index.html')
Expand Down

0 comments on commit 988bd75

Please sign in to comment.