Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(serveStatic): serveStatic option pass-through #36

Merged
merged 1 commit into from
Oct 27, 2017

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Oct 27, 2017

Close #34

@coveralls
Copy link

coveralls commented Oct 27, 2017

Coverage Status

Coverage remained the same at 94.34% when pulling 4a7de1b on add-serve-static-support into 0ac5cd5 on master.

Copy link
Member

@NoahDragon NoahDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@JLHwung JLHwung merged commit 7b972cb into master Oct 27, 2017
@JLHwung JLHwung deleted the add-serve-static-support branch October 27, 2017 14:21
@s25g5d4
Copy link

s25g5d4 commented Apr 27, 2018

It doesn't work; I tried with latest v0.3.1. Say I have a page called about-me, and its path is /about-me.html. Now I try to access that page by url /about-me, and because in

var data = route.get(url);
the server cannot find the /about-me route, it will then redirect user to /about-me/ in the following code of same file (L23~L30). Such path will make serve-static consider that about-me is a directory, and won't try to resolve the file by appending extensions.

I removed the route middleware by commenting out this line

hexo.extend.filter.register('server_middleware', require('./lib/middlewares/route'));
and it worked as intended.

怕上面表達不夠清楚,再用中文說明一次
假設我有個 page 叫 about-me,而我希望可以用 /about-me 存取到這個 page,但因為

var data = route.get(url);
查不到 /about-me 這個路徑,再接下來的程式碼 (23~30 行) 會把頁面重新導向到 /about-me/,而這個路徑是查不到東西的。同時也會造成 serve-static 認為 about-me 是一個資料夾,而不會自動加上副檔名搜尋檔案。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants