update
This commit is contained in:
parent
807c3b0094
commit
b1c4471b95
3 changed files with 24 additions and 43 deletions
6
flake.lock
generated
6
flake.lock
generated
|
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1771848320,
|
||||
"narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
|
||||
"lastModified": 1776169885,
|
||||
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2fc6539b481e1d2569f25f8799236694180c0993",
|
||||
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ ShortUrlInputScheme::inputFromURL(
|
|||
if (!config.hasScheme(url.scheme))
|
||||
return std::nullopt;
|
||||
|
||||
auto expanded = config.expand(url.scheme, url.path, url.query, url.fragment);
|
||||
auto expanded = config.expand(url.scheme, url.renderPath(), url.query, url.fragment);
|
||||
if (!expanded)
|
||||
return std::nullopt;
|
||||
|
||||
|
|
@ -49,49 +49,34 @@ ShortUrlInputScheme::inputFromAttrs(
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
StringSet ShortUrlInputScheme::allowedAttrs() const
|
||||
std::string ShortUrlInputScheme::schemeDescription() const
|
||||
{
|
||||
return {};
|
||||
return "Short URL scheme expansion";
|
||||
}
|
||||
|
||||
const std::map<std::string, nix::fetchers::InputScheme::AttributeInfo> &
|
||||
ShortUrlInputScheme::allowedAttrs() const
|
||||
{
|
||||
static const std::map<std::string, nix::fetchers::InputScheme::AttributeInfo> attrs;
|
||||
return attrs;
|
||||
}
|
||||
|
||||
std::pair<nix::ref<SourceAccessor>, nix::fetchers::Input>
|
||||
ShortUrlInputScheme::getAccessor(nix::ref<Store> store, const nix::fetchers::Input & input) const
|
||||
ShortUrlInputScheme::getAccessor(const nix::fetchers::Settings & settings, Store & store, const nix::fetchers::Input & input) const
|
||||
{
|
||||
// Reconstruct the real Input from the stored attrs (which have the real type).
|
||||
// Call the real scheme's getAccessor directly to avoid double fingerprint assignment
|
||||
// in Input::getAccessorUnchecked.
|
||||
auto attrs = input.toAttrs();
|
||||
auto realInput = nix::fetchers::Input::fromAttrs(*input.settings, std::move(attrs));
|
||||
return realInput.scheme->getAccessor(store, realInput);
|
||||
auto realInput = nix::fetchers::Input::fromAttrs(settings, std::move(attrs));
|
||||
return realInput.scheme->getAccessor(settings, store, realInput);
|
||||
}
|
||||
|
||||
bool ShortUrlInputScheme::isLocked(const nix::fetchers::Input & input) const
|
||||
bool ShortUrlInputScheme::isLocked(const nix::fetchers::Settings & settings, const nix::fetchers::Input & input) const
|
||||
{
|
||||
auto attrs = input.toAttrs();
|
||||
auto realInput = nix::fetchers::Input::fromAttrs(*input.settings, std::move(attrs));
|
||||
return realInput.isLocked();
|
||||
}
|
||||
|
||||
std::optional<std::string>
|
||||
ShortUrlInputScheme::getFingerprint(nix::ref<Store> store, const nix::fetchers::Input & input) const
|
||||
{
|
||||
auto attrs = input.toAttrs();
|
||||
auto realInput = nix::fetchers::Input::fromAttrs(*input.settings, std::move(attrs));
|
||||
return realInput.getFingerprint(store);
|
||||
}
|
||||
|
||||
ParsedURL ShortUrlInputScheme::toURL(const nix::fetchers::Input & input) const
|
||||
{
|
||||
auto attrs = input.toAttrs();
|
||||
auto realInput = nix::fetchers::Input::fromAttrs(*input.settings, std::move(attrs));
|
||||
return realInput.toURL();
|
||||
}
|
||||
|
||||
bool ShortUrlInputScheme::isDirect(const nix::fetchers::Input & input) const
|
||||
{
|
||||
auto attrs = input.toAttrs();
|
||||
auto realInput = nix::fetchers::Input::fromAttrs(*input.settings, std::move(attrs));
|
||||
return realInput.isDirect();
|
||||
auto realInput = nix::fetchers::Input::fromAttrs(settings, std::move(attrs));
|
||||
return realInput.isLocked(settings);
|
||||
}
|
||||
|
||||
} // namespace nix::shorturl
|
||||
|
|
|
|||
|
|
@ -25,19 +25,15 @@ struct ShortUrlInputScheme : nix::fetchers::InputScheme
|
|||
const nix::fetchers::Settings & settings,
|
||||
const nix::fetchers::Attrs & attrs) const override;
|
||||
|
||||
StringSet allowedAttrs() const override;
|
||||
std::string schemeDescription() const override;
|
||||
|
||||
const std::map<std::string, nix::fetchers::InputScheme::AttributeInfo> & allowedAttrs() const override;
|
||||
|
||||
std::pair<nix::ref<SourceAccessor>, nix::fetchers::Input>
|
||||
getAccessor(nix::ref<Store> store, const nix::fetchers::Input & input) const override;
|
||||
getAccessor(const nix::fetchers::Settings & settings, Store & store, const nix::fetchers::Input & input) const override;
|
||||
|
||||
bool isLocked(const nix::fetchers::Input & input) const override;
|
||||
bool isLocked(const nix::fetchers::Settings & settings, const nix::fetchers::Input & input) const override;
|
||||
|
||||
std::optional<std::string>
|
||||
getFingerprint(nix::ref<Store> store, const nix::fetchers::Input & input) const override;
|
||||
|
||||
ParsedURL toURL(const nix::fetchers::Input & input) const override;
|
||||
|
||||
bool isDirect(const nix::fetchers::Input & input) const override;
|
||||
};
|
||||
|
||||
} // namespace nix::shorturl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue