Skip to content

Commit f167bda

Browse files
committed
fix(libstore): enable S3 uploads in curl-based implementation
S3 uploads were failing with "uploading to 's3://...' is not supported" because the enqueueItem function only allowed uploads to HTTP(S) URLs. Since the HttpBinaryCacheStore now handles S3 URLs and generates S3 URLs for upload requests, we need to allow S3 URLs in enqueueItem when AWS CRT support is available. The S3-to-HTTPS conversion already happens in the TransferItem constructor, so this change enables full read/write support for S3 stores. Fixes uploads for commands like: nix copy --to s3://bucket /nix/store/path
1 parent 1dc92c1 commit f167bda

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libstore/filetransfer.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,11 @@ struct curlFileTransfer : public FileTransfer
856856

857857
void enqueueItem(std::shared_ptr<TransferItem> item)
858858
{
859-
if (item->request.data && !hasPrefix(item->request.uri, "http://") && !hasPrefix(item->request.uri, "https://"))
859+
if (item->request.data && !hasPrefix(item->request.uri, "http://") && !hasPrefix(item->request.uri, "https://")
860+
#if NIX_WITH_AWS_CRT_SUPPORT
861+
&& !hasPrefix(item->request.uri, "s3://")
862+
#endif
863+
)
860864
throw nix::Error("uploading to '%s' is not supported", item->request.uri);
861865

862866
{

0 commit comments

Comments
 (0)