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

flag parsing is not working properly #102

Closed
AstonDavies opened this issue Jan 14, 2017 · 3 comments
Closed

flag parsing is not working properly #102

AstonDavies opened this issue Jan 14, 2017 · 3 comments
Assignees
Labels
bug 🐞 Something isn't working

Comments

@AstonDavies
Copy link

Hi

When reading this config:

http://domain.com {
  tls email@example.com
  root /www/site/public
  gzip
  log /var/log/www/site.log
  errors /var/log/www/site.err.log
  basicauth /admin email@example.com password
  hugo /www/site/hugo /admin {
    flag destination /www/site/public
    allow_new true
    allow_edit true
  }
}

the value of flag destination is always set to "true" and the site is published to /www/site/hugo/true on startup.

Caddy 0.9.4

@hacdias
Copy link
Member

hacdias commented Jan 14, 2017

Hello @AstonDavies,

Can you try replacing /www/site/public for "/www/site/public". Anyway, I'll try to reproduce this as soon as I can.

@AstonDavies
Copy link
Author

Hi @hacdias

I have tried with quotes and also with extra parameters after the path. All results are the same.

I have had a look in the source and it's may be because line 130 should check >= rather than just >

			case "flag":
				if !c.NextArg() {
					return cfg, &filemanager.FileManager{}, c.ArgErr()
				}

				values := strings.Split(c.Val(), " ")

				if len(values) == 0 {
					return cfg, fm, errors.New("Not enough arguments for 'flag' option.")
				}

				value := "true"

				if len(values) > 1 {
					value = values[1]
				}

				cfg.Args = append(cfg.Args, "--"+values[0]+"="+value)

I'm not sure as I don't have it setup to compile from source, but I could get organised and try it if that would help.

Thanks

@hacdias hacdias self-assigned this Jan 14, 2017
@hacdias hacdias added the bug 🐞 Something isn't working label Jan 14, 2017
@hacdias
Copy link
Member

hacdias commented Jan 14, 2017

Hey @AstonDavies!

Thanks for your insight! 😄 It's fixed.

hacdias added a commit that referenced this issue May 21, 2019
feature: global settings: add createUserDir option checkbox.
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

No branches or pull requests

2 participants