Skip to content

Commit

Permalink
Merge pull request #1490 from wolfv/mod_etag_issue
Browse files Browse the repository at this point in the history
Fix issue when _mod and/or _etag not set in repodata.json
  • Loading branch information
JohanMabille authored Feb 14, 2022
2 parents f95c16e + a862708 commit 69099f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libmamba/src/core/subdirdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@ namespace mamba
{
RepoMetadata meta{ m_repodata_url,
Context::instance().add_pip_as_python_dependency,
m_mod_etag["_etag"],
m_mod_etag["_mod"] };
m_mod_etag.value("_etag", ""),
m_mod_etag.value("_mod", "") };

return MRepo(pool, m_name, cache_path(), meta);
}
Expand Down
1 change: 1 addition & 0 deletions libmamba/tests/repodata_json_cache/test_6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_url": "https://conda.anaconda.org/intake/osx-arm64", "_mod": "Thu, 02 Apr 2020 20:21:27 GMT", "info":{"platform":"osx","default_python_version":"2.7","arch":"arm64","subdir":"osx-arm64","default_numpy_version":"1.7"},"packages":{}}
5 changes: 5 additions & 0 deletions libmamba/tests/test_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@ namespace mamba

j = detail::read_mod_and_etag(cache_folder / "test_3.json");
EXPECT_TRUE(j.empty());

j = detail::read_mod_and_etag(cache_folder / "test_6.json");
EXPECT_EQ(j["_mod"], "Thu, 02 Apr 2020 20:21:27 GMT");
EXPECT_EQ(j["_url"], "https://conda.anaconda.org/intake/osx-arm64");

// EXPECT_EQ(j["_mod"], "Fri, 11 Feb 2022 13:52:44 GMT");
// EXPECT_EQ(j["_url"], "file:///Users/wolfvollprecht/Programs/mamba/mamba/tests/channel_a/linux-64/repodata.json");
}
Expand Down

0 comments on commit 69099f3

Please sign in to comment.