Skip to content

Commit

Permalink
Bug fix: Encode URI paths correctly in HTTP resolver; Update vendor deps
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisaaronland committed Mar 9, 2022
1 parent 6782321 commit 1e6804a
Show file tree
Hide file tree
Showing 150 changed files with 13,757 additions and 8,533 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@ Providers implement the `provider.Provider` interface and are used to generate a

resolvers implement the `resolver.Resolver` interfave and are used for retrieving repository data from a variety of storage systems.

### Docstore

Resolve findingaids using a `gocloud.dev/docstore` compatible storage endpoint.

### HTTP

Resolve findingaids using a HTTP(S) endpoint. For example:

```
findingaid://https/static.sfomuseum.org/findingaid/
```

### SQL

Resolve findingaids using a `database/sql` compatible database.

## Tools

### csv2sql
Expand Down
6 changes: 3 additions & 3 deletions cmd/csv2docstore/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func main() {
monitor, err := timings.NewCounterMonitor(ctx, d)

if err != nil {
log.Fatalf("Failed to create timings monitor, %w", err)
log.Fatalf("Failed to create timings monitor, %v", err)
}

monitor.Start(ctx, os.Stdout)
Expand Down Expand Up @@ -109,7 +109,7 @@ func processArchive(ctx context.Context, path string, collection *gc_docstore.Co
f, err := os.Open(path)

if err != nil {
return fmt.Errorf("Failed to open archive %s, %w", path, err)
return fmt.Errorf("Failed to open archive %s, %v", path, err)
}

defer f.Close()
Expand Down Expand Up @@ -210,7 +210,7 @@ func processArchiveWithReader(ctx context.Context, r io.Reader, collection *gc_d
lookup, err := processSources(ctx, sources_r)

if err != nil {
return fmt.Errorf("Failed to derive sources lookup, %w")
return fmt.Errorf("Failed to derive sources lookup, %w", err)
}

catalog_r, err := os.Open(catalog_tmp)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ require (
github.com/aaronland/go-brooklynintegers-api v1.2.4
github.com/aaronland/go-http-server v0.0.7
github.com/aaronland/go-roster v0.0.2
github.com/aws/aws-sdk-go v1.42.50
github.com/aws/aws-sdk-go v1.43.15
github.com/jtacoma/uritemplates v1.0.0
github.com/mattn/go-sqlite3 v1.14.11
github.com/mattn/go-sqlite3 v1.14.12
github.com/sfomuseum/go-csvdict v1.0.0
github.com/sfomuseum/go-flags v0.8.2
github.com/sfomuseum/go-timings v0.0.1
Expand All @@ -19,7 +19,7 @@ require (
github.com/whosonfirst/go-whosonfirst-github v0.4.0
github.com/whosonfirst/go-whosonfirst-iterate-git/v2 v2.1.0
github.com/whosonfirst/go-whosonfirst-iterate/v2 v2.0.1
github.com/whosonfirst/go-whosonfirst-uri v1.1.0
github.com/whosonfirst/go-whosonfirst-uri v1.2.0
github.com/whosonfirst/iso8601duration v0.0.0-20150204201828-8da3af7a2a61
gocloud.dev v0.24.0
google.golang.org/protobuf v1.27.1
Expand Down
11 changes: 11 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ github.com/aws/aws-sdk-go v1.42.47 h1:Faabrbp+bOBiZjHje7Hbhvni212aQYQIXZMruwkgmm
github.com/aws/aws-sdk-go v1.42.47/go.mod h1:OGr6lGMAKGlG9CVrYnWYDKIyb829c6EVBRjxqjmPepc=
github.com/aws/aws-sdk-go v1.42.50 h1:FA5pbpkLz2fdnMt+AWyHnNaIA269rqr/sYAe3WKCYN4=
github.com/aws/aws-sdk-go v1.42.50/go.mod h1:OGr6lGMAKGlG9CVrYnWYDKIyb829c6EVBRjxqjmPepc=
github.com/aws/aws-sdk-go v1.43.15 h1:zAOUdqgNgJrkivRZi93NTjPNvuIQ5EcqNHSk0A1jrk8=
github.com/aws/aws-sdk-go v1.43.15/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go-v2 v1.9.0 h1:+S+dSqQCN3MSU5vJRu1HqHrq00cJn6heIMU7X9hcsoo=
github.com/aws/aws-sdk-go-v2 v1.9.0/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4=
github.com/aws/aws-sdk-go-v2/config v1.7.0 h1:J2cZ7qe+3IpqBEXnHUrFrOjoB9BlsXg7j53vxcl5IVg=
Expand Down Expand Up @@ -368,6 +370,8 @@ github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/K
github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.11 h1:gt+cp9c0XGqe9S/wAHTL3n/7MqY+siPWgWJgqdsFrzQ=
github.com/mattn/go-sqlite3 v1.14.11/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0=
github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
Expand Down Expand Up @@ -459,6 +463,8 @@ github.com/whosonfirst/go-whosonfirst-sources v0.1.0/go.mod h1:EUMHyGzUmqPPxlMmO
github.com/whosonfirst/go-whosonfirst-uri v1.0.1/go.mod h1:8eaDVcc4v+HHHEDaRbApdmhPwM4/JQllw2PktvZcPVs=
github.com/whosonfirst/go-whosonfirst-uri v1.1.0 h1:kNYOmKSm3u2asUOeq7yXL1Q8gFKkPIl8A0qinKrGV/8=
github.com/whosonfirst/go-whosonfirst-uri v1.1.0/go.mod h1:8eaDVcc4v+HHHEDaRbApdmhPwM4/JQllw2PktvZcPVs=
github.com/whosonfirst/go-whosonfirst-uri v1.2.0 h1:lhmRsIhcpTr5HAo+kXKRGsSt76HTh3Ko/oTR2jpCm/o=
github.com/whosonfirst/go-whosonfirst-uri v1.2.0/go.mod h1:CuVygTCUpMG945MMvqHyqxvc/L5YkDaMrrVpRFr7ZxY=
github.com/whosonfirst/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 h1:RAMdXkrLd61MoLAw8yRbEuE74+NY+ojnjYCGA2sk57s=
github.com/whosonfirst/iso8601duration v0.0.0-20150204201828-8da3af7a2a61/go.mod h1:mT7JgXlZYn9Ct77XmFiCDqdp0vEgWvRjC9mnY0lT6Lo=
github.com/whosonfirst/walk v0.0.1 h1:t0QrqGwOdPMSeovFZSXfiS0GIGHrRXK3Wb9z5Uhs2bg=
Expand Down Expand Up @@ -589,6 +595,8 @@ golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -679,7 +687,10 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e h1:XMgFehsDnnLGtjvjOfqWSUzt0alpTR1RSEuznObga2c=
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
7 changes: 4 additions & 3 deletions resolver/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
_ "log"
"net/http"
"net/url"
"path/filepath"
"strconv"
)

Expand Down Expand Up @@ -47,10 +48,10 @@ func (r *HTTPResolver) GetRepo(ctx context.Context, id int64) (string, error) {
if err != nil {
return "", fmt.Errorf("Failed to parse endpoint URL, %w", err)
}

str_id := strconv.FormatInt(id, 10)
u.Path = fmt.Sprintf("/%s", str_id)

u.Path = filepath.Join(u.Path, str_id)
rsp, err := http.Get(u.String())

if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/aws/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e6804a

Please sign in to comment.