Skip to content

Commit

Permalink
Merge branch 'master' into rvagg/dag-import-nopindefault
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel authored Jun 14, 2023
2 parents b30f46b + f5f6b66 commit 249c1b0
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 415 deletions.
20 changes: 12 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
time: "11:00"
open-pull-requests-limit: 10
labels:
- "topic/dependencies"
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
time: "11:00"
open-pull-requests-limit: 10
labels:
- "topic/dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: 16.12.0
node-version: 18.14.0
- uses: actions/download-artifact@v3
with:
name: kubo
Expand Down
19 changes: 1 addition & 18 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,4 @@ on:

jobs:
stale:

runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.'
close-issue-message: 'This issue was closed because it is missing author input.'
stale-issue-label: 'kind/stale'
any-of-labels: 'need/author-input'
exempt-issue-labels: 'need/triage,need/community-input,need/maintainer-input,need/maintainers-input,need/analysis,status/blocked,status/in-progress,status/ready,status/deferred,status/inactive'
days-before-issue-stale: 6
days-before-issue-close: 7
enable-statistics: true
uses: pl-strflt/.github/.github/workflows/reusable-stale-issue.yml@v0.3
2 changes: 1 addition & 1 deletion core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Specification of CAR formats: https://ipld.io/specs/transport/car/
}

if event.Root.PinErrorMsg != "" {
event.Root.PinErrorMsg = fmt.Sprintf("FAILED: %s", event.Root.PinErrorMsg)
return fmt.Errorf("pinning root %q FAILED: %s", enc.Encode(event.Root.Cid), event.Root.PinErrorMsg)
} else {
event.Root.PinErrorMsg = "success"
}
Expand Down
25 changes: 21 additions & 4 deletions core/commands/dag/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package dagcmd

import (
"errors"
"fmt"
"io"

"github.com/ipfs/boxo/coreiface/options"
"github.com/ipfs/boxo/files"
gocarv2 "github.com/ipfs/boxo/ipld/car/v2"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
cmds "github.com/ipfs/go-ipfs-cmds"
ipld "github.com/ipfs/go-ipld-format"
Expand Down Expand Up @@ -58,6 +60,18 @@ func dagImport(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment
roots := cid.NewSet()
var blockCount, blockBytesCount uint64

// remember last valid block and provide a meaningful error message
// when a truncated/mangled CAR is being imported
importError := func(previous blocks.Block, current blocks.Block, err error) error {
if current != nil {
return fmt.Errorf("import failed at block %q: %w", current.Cid(), err)
}
if previous != nil {
return fmt.Errorf("import failed after block %q: %w", previous.Cid(), err)
}
return fmt.Errorf("import failed: %w", err)
}

it := req.Files.Entries()
for it.Next() {
file := files.FileFromEntry(it)
Expand All @@ -75,6 +89,8 @@ func dagImport(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment
// this won't/can't help with not running out of handles
defer file.Close()

var previous blocks.Block

car, err := gocarv2.NewBlockReader(file)
if err != nil {
return err
Expand All @@ -87,25 +103,26 @@ func dagImport(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment
for {
block, err := car.Next()
if err != nil && err != io.EOF {
return err
return importError(previous, block, err)
} else if block == nil {
break
}
if err := cmdutils.CheckBlockSize(req, uint64(len(block.RawData()))); err != nil {
return err
return importError(previous, block, err)
}

// the double-decode is suboptimal, but we need it for batching
nd, err := blockDecoder.DecodeNode(req.Context, block)
if err != nil {
return err
return importError(previous, block, err)
}

if err := batch.Add(req.Context, nd); err != nil {
return err
return importError(previous, block, err)
}
blockCount++
blockBytesCount += uint64(len(block.RawData()))
previous = block
}
return nil
}()
Expand Down
3 changes: 2 additions & 1 deletion core/corehttp/webui.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package corehttp

// TODO: move to IPNS
const WebUIPath = "/ipfs/bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm" // v3.0.0
const WebUIPath = "/ipfs/bafybeigs6d53gpgu34553mbi5bbkb26e4ikruoaaar75jpfdywpup2r3my" // v4.0.1

// WebUIPaths is a list of all past webUI paths.
var WebUIPaths = []string{
WebUIPath,
"/ipfs/bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm",
"/ipfs/bafybeifeqt7mvxaniphyu2i3qhovjaf3sayooxbh5enfdqtiehxjv2ldte",
"/ipfs/bafybeiequgo72mrvuml56j4gk7crewig5bavumrrzhkqbim6b3s2yqi7ty",
"/ipfs/bafybeibjbq3tmmy7wuihhhwvbladjsd3gx3kfjepxzkq6wylik6wc3whzy",
Expand Down
2 changes: 1 addition & 1 deletion docs/changelogs/v0.21.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ for clients that do not follow redirects by default:

```console
$ curl "https://subdomain-gw.example.net/ipfs/${cid}/"
<a href="http://${cid}.ipfs.subdomain-gw.example.net/">Moved Permanently</a>.
<a href="https://${cid}.ipfs.subdomain-gw.example.net/">Moved Permanently</a>.
```

Rationale can be found in [kubo#9913](https://github.com/ipfs/kubo/pull/9913).
Expand Down
Loading

0 comments on commit 249c1b0

Please sign in to comment.