Skip to content

Commit

Permalink
Merge pull request #324 from filecoin-saturn/feat/update-lassie-v0.8.1
Browse files Browse the repository at this point in the history
update lassie v0.8.1
  • Loading branch information
guanzo authored Apr 7, 2023
2 parents 9084aa6 + e77d4f4 commit 6d72310
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \

# Download lassie
ARG TARGETPLATFORM
ARG LASSIE_VERSION="v0.7.0"
ARG LASSIE_VERSION="v0.8.1"
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=amd64; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCHITECTURE=arm64; \
else ARCHITECTURE=386; fi \
Expand Down
20 changes: 12 additions & 8 deletions container/shim/src/fetchers/lassie.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,17 @@ function createLassieURL(req, isRawFormat) {
// translate depth parameter for lassie
let newKey = key;
let newVal = val;
if (key === "depth" && (val === "1" || val === "0")) {
newKey = "depthType";
newVal = "shallow";
if (key === "depth" && val === "1") {
newKey = "car-scope";
newVal = "file";
}
if (key === "depth" && val === "0") {
newKey = "car-scope";
newVal = "root";
}
if (key === "depth" && val === "all") {
newKey = "depthType";
newVal = "full";
newKey = "car-scope";
newVal = "all";
}
lassieUrl.searchParams.set(newKey, toUtf8(newVal));
}
Expand All @@ -178,13 +182,13 @@ function createLassieURL(req, isRawFormat) {
}

// if no depth type set
if (!lassieUrl.searchParams.has("depthType")) {
if (!lassieUrl.searchParams.has("car-scope")) {
if (isRawFormat) {
// for raw, default to shallow
lassieUrl.searchParams.set("depthType", "shallow");
lassieUrl.searchParams.set("car-scope", "file");
} else {
// for everything else, default to full
lassieUrl.searchParams.set("depthType", "full");
lassieUrl.searchParams.set("car-scope", "all");
}
}

Expand Down

0 comments on commit 6d72310

Please sign in to comment.