ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.18k stars 3.02k forks source link

ipfs add doesn't work on files with "%" in the name #10536

Open bjl73o opened 1 month ago

bjl73o commented 1 month ago

Checklist

Installation method

ipfs-desktop

Version

Kubo version: 0.30.0

Config

{
    "API": {
      "HTTPHeaders": {
        "Access-Control-Allow-Credentials": [
          "true"
        ],
        "Access-Control-Allow-Methods": [
          "OPTIONS",
          "GET",
          "POST"
        ],
        "Access-Control-Allow-Origin": [
          "*"
        ]
      }
    },
    "Addresses": {
      "API": "/ip4/127.0.0.1/tcp/5001",
      "Announce": [
        "/ip4/(redacted)/tcp/4001",
        "/ip4/(redacted)/udp/4002/webrtc-direct",
        "/ip4/(redacted)/udp/4002/quic-v1",
        "/ip4/(redacted)/udp/4002/quic-v1/webtransport"
      ],
      "AppendAnnounce": null,
      "Gateway": "/ip4/0.0.0.0/tcp/8080",
      "NoAnnounce": [
        "/ip4/10.0.0.0/ipcidr/8",
        "/ip4/100.64.0.0/ipcidr/10",
        "/ip4/169.254.0.0/ipcidr/16",
        "/ip4/172.16.0.0/ipcidr/12",
        "/ip4/192.0.0.0/ipcidr/24",
        "/ip4/192.0.2.0/ipcidr/24",
        "/ip4/192.168.0.0/ipcidr/16",
        "/ip4/198.18.0.0/ipcidr/15",
        "/ip4/198.51.100.0/ipcidr/24",
        "/ip4/203.0.113.0/ipcidr/24",
        "/ip4/240.0.0.0/ipcidr/4",
        "/ip6/100::/ipcidr/64",
        "/ip6/2001:2::/ipcidr/48",
        "/ip6/2001:db8::/ipcidr/32",
        "/ip6/fc00::/ipcidr/7",
        "/ip6/fe80::/ipcidr/10"
      ],
      "Swarm": [
        "/ip4/0.0.0.0/tcp/4001",
        "/ip6/::/tcp/4001",
        "/ip4/0.0.0.0/udp/4002/webrtc-direct",
        "/ip4/0.0.0.0/udp/4002/quic-v1",
        "/ip4/0.0.0.0/udp/4002/quic-v1/webtransport",
        "/ip6/::/udp/4002/webrtc-direct",
        "/ip6/::/udp/4002/quic-v1",
        "/ip6/::/udp/4002/quic-v1/webtransport"
      ]
    },
    "AutoNAT": {},
    "Bootstrap": [
      "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
      "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
      "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
      "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
      "/ip4/(redacted)/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
    ],
    "DNS": {
      "Resolvers": null
    },
    "Datastore": {
      "BloomFilterSize": 1048576,
      "GCPeriod": "30m",
      "HashOnRead": false,
      "Spec": {
        "mounts": [
          {
            "child": {
              "path": "blocks",
              "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
              "sync": true,
              "type": "flatfs"
            },
            "mountpoint": "/blocks",
            "prefix": "flatfs.datastore",
            "type": "measure"
          },
          {
            "child": {
              "compression": "none",
              "path": "datastore",
              "type": "levelds"
            },
            "mountpoint": "/",
            "prefix": "leveldb.datastore",
            "type": "measure"
          }
        ],
        "type": "mount"
      },
      "StorageGCWatermark": 70,
      "StorageMax": "2000GB"
    },
    "Discovery": {
      "MDNS": {
        "Enabled": true
      }
    },
    "Experimental": {
      "FilestoreEnabled": false,
      "GraphsyncEnabled": false,
      "Libp2pStreamMounting": false,
      "P2pHttpProxy": false,
      "ShardingEnabled": false,
      "StrategicProviding": false,
      "UrlstoreEnabled": false
    },
    "ExperimentalLibp2pStreamMounting": false,
    "Gateway": {
      "APICommands": [],
      "HTTPHeaders": {
        "Access-Control-Allow-Methods": [
          "GET",
          "HEAD"
        ],
        "Access-Control-Allow-Origin": [
          "*"
        ]
      },
      "NoDNSLink": false,
      "NoFetch": false,
      "PathPrefixes": [],
      "PublicGateways": null,
      "RootRedirect": "",
      "Writable": false
    },
    "Identity": {
      "PeerID": "(redacted)"
    },
    "Internal": {},
    "Ipns": {
      "RecordLifetime": "",
      "RepublishPeriod": "",
      "ResolveCacheSize": 500
    },
    "Libp2pStreamMounting": false,
    "Migration": {
      "DownloadSources": null,
      "Keep": ""
    },
    "Mounts": {
      "FuseAllowOther": false,
      "IPFS": "/ipfs",
      "IPNS": "/ipns"
    },
    "Peering": {
      "Peers": [
        {
          "Addrs": [
            "/ip4/(redacted)/tcp/4001",
            "/ip4/(redacted)/udp/4001/quic-v1",
            "/ip4/(redacted)/udp/4001/quic-v1/webtransport"
          ],
          "ID": "(redacted)"
        }
      ]
    },
    "Pinning": {},
    "Plugins": {
      "Plugins": null
    },
    "Provider": {
      "Strategy": ""
    },
    "Pubsub": {
      "DisableSigning": false,
      "Router": ""
    },
    "Reprovider": {
      "Strategy": "pinned"
    },
    "Routing": {
      "AcceleratedDHTClient": true,
      "Methods": null,
      "Routers": null
    },
    "Swarm": {
      "AddrFilters": null,
      "ConnMgr": {},
      "DisableBandwidthMetrics": false,
      "DisableNatPortMap": false,
      "EnableAutoRelay": false,
      "EnableRelayHop": false,
      "RelayClient": {
        "Enabled": false
      },
      "RelayService": {
        "Enabled": true
      },
      "ResourceMgr": {
        "Enabled": false
      },
      "Transports": {
        "Multiplexers": {},
        "Network": {},
        "Security": {}
      }
    }
  }

Description

Create an empty folder Create an empty file in that folder, and name it anything. Include % in the name. Add the folder to Kubo with ipfs add -r path

added QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn path/100 added QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn path/100% added QmSSYRtVFpWBEXCKKJbLv78ixGYXZhs5gX6rVdYjyhYgw4 path

Copy the folder CID from the terminal Open the link containing % in the browser Observe the error: 400 Bad Request 1

bjl73o commented 1 month ago

1