diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T01·19+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T01·19+0100 |
commit | b99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 (patch) | |
tree | 1f76047dd027421dcf79cdf4804fa5ff1bb08b2b /third_party/nix/src/libstore/download.cc | |
parent | 8cf1322a6fd5ae282d8a09fdba634f27a1a88560 (diff) |
refactor(3p/nix/libutil): Replace hasPrefix/Suffix with Abseil r/845
Uses the equivalent absl::StartsWith and absl::EndsWith functions instead.
Diffstat (limited to 'third_party/nix/src/libstore/download.cc')
-rw-r--r-- | third_party/nix/src/libstore/download.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/third_party/nix/src/libstore/download.cc b/third_party/nix/src/libstore/download.cc index bebe0d1bf848..8b36063dabc5 100644 --- a/third_party/nix/src/libstore/download.cc +++ b/third_party/nix/src/libstore/download.cc @@ -1,6 +1,7 @@ #include "download.hh" #include <absl/strings/ascii.h> +#include <absl/strings/match.h> #include <absl/strings/numbers.h> #include "archive.hh" @@ -653,8 +654,8 @@ struct CurlDownloader : public Downloader { } void enqueueItem(const std::shared_ptr<DownloadItem>& item) { - if (item->request.data && !hasPrefix(item->request.uri, "http://") && - !hasPrefix(item->request.uri, "https://")) { + if (item->request.data && !absl::StartsWith(item->request.uri, "http://") && + !absl::StartsWith(item->request.uri, "https://")) { throw nix::Error("uploading to '%s' is not supported", item->request.uri); } @@ -690,7 +691,7 @@ struct CurlDownloader : public Downloader { void enqueueDownload(const DownloadRequest& request, Callback<DownloadResult> callback) override { /* Ugly hack to support s3:// URIs. */ - if (hasPrefix(request.uri, "s3://")) { + if (absl::StartsWith(request.uri, "s3://")) { // FIXME: do this on a worker thread try { #ifdef ENABLE_S3 |