Ver a proveniência

fix post url for non standard hostnames

pull/36/head
Rob Loranger há 4 anos
ascendente
cometimento
05380e618f
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados ID da chave GPG: D6F1633A4F0903B8
1 ficheiros alterados com 23 adições e 3 eliminações
  1. +23
    -3
      commands/commands.go

+ 23
- 3
commands/commands.go Ver ficheiro

@@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"text/tabwriter"

"github.com/howeyc/gopass"
@@ -262,9 +263,28 @@ func CmdListPosts(c *cli.Context) error {
}

func getPostURL(c *cli.Context, slug string) string {
base := config.WriteasBaseURL
if config.IsDev() {
base = config.DevBaseURL
var base string
if c.App.Name == "writeas" {
if config.IsDev() {
base = config.DevBaseURL
} else {
base = config.WriteasBaseURL
}
} else {
if host := api.HostURL(c); host != "" {
base = host
} else {
// TODO handle error, or load config globally, see T601
// https://phabricator.write.as/T601
cfg, _ := config.LoadConfig(config.UserDataDir(c.App.ExtraInfo()["configDir"]))
if cfg.Default.Host != "" && cfg.Default.User != "" {
if parts := strings.Split(cfg.Default.Host, "://"); len(parts) > 1 {
base = cfg.Default.Host
} else {
base = "https://" + cfg.Default.Host
}
}
}
}
ext := ""
// Output URL in requested format


Carregando…
Cancelar
Guardar