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

New site can't be initialized with Index.org #380

Closed
precompute opened this issue Nov 19, 2022 · 6 comments · Fixed by #387
Closed

New site can't be initialized with Index.org #380

precompute opened this issue Nov 19, 2022 · 6 comments · Fixed by #387
Labels
bug Something isn't working
Milestone

Comments

@precompute
Copy link

Describe the bug

A new emanote website can't be init with an index.org file, but an index.md file works.

To Reproduce

Make a new (empty) folder, run emanote run.

Then make an index.org file.

The following error occurs:

[Info#emanote] [13:34:17] Reading file: /exte/zz/temp/containers/emanote/test/index.org
emanote: attempt to encode an ambiguous route: /
CallStack (from HasCallStack):
  error, called at src/Relude/Debug.hs:288:11 in relude-1.0.0.1-FljEYV1xvt0It3QAhHDj9h:Relude.Debug
  error, called at src/Emanote/Route/SiteRoute/Class.hs:82:9 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote.Route.SiteRoute.Class
  emanoteRouteEncoder, called at src/Emanote.hs:49:27 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote
[Info#ema.ws.02] Connected
emanote: attempt to encode an ambiguous route: /
CallStack (from HasCallStack):
  error, called at src/Relude/Debug.hs:288:11 in relude-1.0.0.1-FljEYV1xvt0It3QAhHDj9h:Relude.Debug
  error, called at src/Emanote/Route/SiteRoute/Class.hs:82:9 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote.Route.SiteRoute.Class
  emanoteRouteEncoder, called at src/Emanote.hs:49:27 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote

Using an index.md file works without any errors.

@precompute precompute added the bug Something isn't working label Nov 19, 2022
@precompute
Copy link
Author

precompute commented Nov 19, 2022

This issue is also present when creating the "example.org" file for a folder named "example" (or similar).

Steps to Reproduce

mkdir Blog
touch Blog.org

.md works as expected.

@srid srid added this to the 0.8 milestone Nov 19, 2022
@srid
Copy link
Owner

srid commented Nov 19, 2022

@t-e-r-m I can only reproduce the bug with index.org.

example.org works fine for me.

@srid
Copy link
Owner

srid commented Nov 19, 2022

Getting rid of https://github.com/EmaApps/emanote/blob/master/default/index.md from the default layer will resolve this, but that's not really a solution because emanote assumes the default index note always exists:

emanote: attempt to encode missing note: LMLRoute_Md R[/index.md]
CallStack (from HasCallStack):
  error, called at src/Relude/Debug.hs:288:11 in relude-1.0.0.1-FljEYV1xvt0It3QAhHDj9h:Relude.Debug
  error, called at src/Emanote/Route/SiteRoute/Class.hs:102:10 in main:Emanote.Route.SiteRoute.Class
  encodeResourceRoute, called at src/Emanote/Route/SiteRoute/Class.hs:84:9 in main:Emanote.Route.SiteRoute.Class
  emanoteRouteEncoder, called at src/Emanote.hs:49:27 in main:Emanote

@srid
Copy link
Owner

srid commented Nov 19, 2022

@t-e-r-m You can try this patch for now, though a proper fix needs to be thought of carefully to resolve this in master.

diff --git a/src/Emanote/Route/SiteRoute/Class.hs b/src/Emanote/Route/SiteRoute/Class.hs
index 6cbe6e0c..cf4fb607 100644
--- a/src/Emanote/Route/SiteRoute/Class.hs
+++ b/src/Emanote/Route/SiteRoute/Class.hs
@@ -121,10 +121,7 @@ decodeGeneratedRoute model fp =
       Rel.RRTFound note ->
         Just $ noteFileSiteRoute note
       Rel.RRTAmbiguous notes ->
-        Just $ ambiguousNoteURLsRoute notes
-    ambiguousNoteURLsRoute :: NonEmpty N.Note -> SiteRoute
-    ambiguousNoteURLsRoute ns =
-      SiteRoute_AmbiguousR ("/" <> fp) (N._noteRoute <$> ns)
+        Just $ noteFileSiteRoute $ last notes
 
 noteFileSiteRoute :: N.Note -> SiteRoute
 noteFileSiteRoute =

@precompute
Copy link
Author

Thank you for the patch.

@srid
Copy link
Owner

srid commented Nov 27, 2022

Should be resolved in #387 once it is merged; please re-open if the problem still occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants