claudioc / jingo

Node.js based Wiki
MIT License
1.02k stars 184 forks source link

Redirect Loop #58

Closed M-Pixel closed 9 years ago

M-Pixel commented 9 years ago

Steps

  1. Clone Jingo
  2. Create directory wiki_src
  3. Create config.yaml in wiki_src
  4. Set username and password in config.yaml, set application.repository to "wiki_src"
  5. Fire up the server. It works!
  6. Create the home document in the web gui.
  7. Save
  8. Get error wiki_src/.git is not a git repository
  9. Hit back
  10. Hit save again

The result is a redirect loop.

It looks like Home.md was saved, however.

What sort of log files should I check to help diagnose this issue? Environment is Windows, Node 0.10.

claudioc commented 9 years ago

Hi, thank you for reporting this. Unfortunately at the moment I don't have a Windows system to test it. Generally I say that "Windows is not officially supported" (because I don't test in that environment), but maybe this is a symptom of something else. I'll take a look but don't hold your breath :)

M-Pixel commented 9 years ago

It's redirecting between /pages/new/Home and /wiki/Home Perhaps the pages/new and wiki routes disagree on weather Home exists yet.

M-Pixel commented 9 years ago

I was able to console.log my error and it comes out as

git --git-dir=wiki_src\.git --work-tree=wiki_src show HEAD:Home.md fatal: Not a git repository: 'wiki_src\.git'

However, when I run git --git-dir=wiki_src\.git --work-tree=wiki_src show HEAD:Home.md from my command line from the same directory, it successfully displays the file contents.

I see that gitmech uses repoDir as the cwd, and repoDir comes in for me as wiki_src, so I think the problem is that it's trying to access wiki_src\wiki_src\.git instead of wiki_src\.git.

I was able to fix the problem by changing { cwd: workTree } to { cwd: '' } on line 13 of gitmech.js, however I think this is probably a non-ideal hack so I'm not going to submit a pull request.

crockpotveggies commented 9 years ago

Confirmed that I experienced this same issue on OS X and @theqwertman's proposed fix was a solution for me.

claudioc commented 9 years ago

Hi,

if it's confirmed on OSX too, please add the steps to reproduce it. What I did:

Thank you!

crockpotveggies commented 9 years ago

Followed your exact steps with one major difference, the path was using the ~/userdirectory syntax. Although I wasn't expecting this to be an issue, it does appear to affect it. I haven't looked deeply into the code so my guess is that GIT must be running as a different user and, thus, is trying to access a different directory.

I ran into a similar problem when setting up the Dockerfile. The GIT binary used inside Docker behaves differently than the native system GIT.

I'm not sure if there's a way to support the ~ syntax in paths, but it does seem to be a limitation from an "ease-of-use" point of view. However, my issue can be considered as resolved.

pol commented 8 years ago

Using gitlab, which uses gollum wikis.

  1. Clone the wiki repo into foo.wiki
  2. Create a jingo.yaml file in the pwd that specifies a full path to the foo.wiki directory as the repository.
  3. The contents of the wiki are currently only a home.md with some minimal content.
  4. Start jingo with jingo -c ./jingo.yaml
  5. Go to the web UI and log in: Webpage redirect loop. The log has a giant list of:
127.0.0.1 - - [25/Feb/2016:16:28:57 +0000] "GET /pages/new/Home HTTP/1.1" 302 64 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"
127.0.0.1 - - [25/Feb/2016:16:28:57 +0000] "GET /wiki/Home HTTP/1.1" 302 74 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"
...

Tried the fix posted by @theqwertman, but it didn't fix the problem. I will try an empty repository (maybe the initial home.md is a problem?).

pol commented 8 years ago

Fixed the problem by renaming "home.md" to "Home.md". I think this is a problem with the OSX filesystem being case-insensitive by default (so the page was and wasn't there if you looked for "Home.md", depending on how you asked).

Perhaps the system should go full case-insensitive to avoid this problem? Is it likely that you will have mixed-case documents side-by-side?