Skip to content

Avoid re-opening files when serving from a directory#42

Merged
kanongil merged 1 commit intohapijs:masterfrom
kanongil:no-dir-file-reopen
Oct 2, 2015
Merged

Avoid re-opening files when serving from a directory#42
kanongil merged 1 commit intohapijs:masterfrom
kanongil:no-dir-file-reopen

Conversation

@kanongil
Copy link
Copy Markdown
Contributor

The file prepare phase is inadvertently called twice for the same file when served via the directory handler.

This patch fixes the issue by skipping the prepare phase once the response has been submitted. I have added an additional test to verify this behavior.

This issue is mostly a performance problem, though it can in extreme cases cause incorrect behavior if the file is moved / deleted between the two calls to the prepare function.

@kanongil kanongil added the bug Bug or defect label Sep 27, 2015
@kanongil kanongil added this to the 3.0.2 milestone Oct 2, 2015
kanongil added a commit that referenced this pull request Oct 2, 2015
Avoid re-opening files when serving from a directory
@kanongil kanongil merged commit 10c7a3a into hapijs:master Oct 2, 2015
@lock
Copy link
Copy Markdown

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant