Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update lassie v0.8.1 #324

Merged
merged 1 commit into from Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
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
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";
Copy link

@lidel lidel Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hannahhoward is this a typo or did we implement different things? 🙈

ipfs/bifrost-gateway#80https://github.com/ipfs/bifrost-gateway/pull/81/files → I did block instead of root as we used both during discussion, and I went with block as it felt more descriptive (just like file is more than adl).

(not the end of the world, no need to revert release, bifrost-gateway still sends depth=0 so it will work fine, but we should clean this up next week before we remove depth)

}
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