Markbind: `markbind serve` should not serve a non-existent root directory

Created on 15 Jan 2019  路  6Comments  路  Source: MarkBind/markbind

Tell us about your environment

  • MarkBind Version: 1.16.1

What did you do? Please include the actual source code causing the issue.

  1. markbind init on an empty directory.
  2. Do markbind serve nonExistentRoot (nonExistentRoot/ does not exist on the new website).

What did you expect to happen?
The command should fail, since the root directory given does not exist.

What actually happened? Please include the actual, raw output.
MarkBind creates a new folder nonExistentRoot and generates _site/ inside the new folder. It seems to just serve the folder that was just init.

c.Bug 馃悰 p.Low

Most helpful comment

I believe this change is related to the problem
https://github.com/MarkBind/markbind/pull/202

If we're not careful we may break some features. Will help to investigate. Sorry for the late follow up 馃槗

All 6 comments

I've made a PR #584 that should address this issue! 馃檪

I believe this change is related to the problem
https://github.com/MarkBind/markbind/pull/202

If we're not careful we may break some features. Will help to investigate. Sorry for the late follow up 馃槗

Seems like the behaviour introduced in https://github.com/MarkBind/markbind/pull/202 allows users to call markbind serve in any sub directory of a markbind site.

However with findUp implementation below:
https://github.com/MarkBind/markbind/blob/b01d1b3dd8cb0eec54df6d2d5c774be7a76c47ec/src/Site.js#L114-L115

It may search for site.json outside of a directory which is undesirable.

Perhaps we should enforce markbind serve to be called at project root?

It may search for site.json outside of a directory which is undesirable.

Are you saying that, with the example below, if I cd to a/b/c/, and do a markbind serve, it might pick up a/b/d/site.json?

a
|-----b
      |------c     <- I serve inside this directory
      |
      |------d
             |-----site.json

Perhaps we should enforce markbind serve to be called at project root?

Serving inside a sub directory of a MarkBind website is a convenient feature for the authors, so unless the bug is as severe as the one described above, we should think twice about removing the feature.

Are you saying that, with the example below, if I cd to a/b/c/, and do a markbind serve, it might pick up a/b/d/site.json?

Oh no, i meant the opposite.

a
|-----b
      |------c  
      |      |------d    <- I serve inside this directory
      |-----site.json

Serving in a/b/c/d will detect a/b/site.json. This may be undesirable if there is no site.json in your site and it detects some other site.json at higher level. eg: you have a C:/site.json that may not be even related to markbind.

I think that is fine.

But if [root] in markbind serve [root] is specified, then it should contain site.json.

Was this page helpful?
0 / 5 - 0 ratings