Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

BUG: AzureBlobStorageTarget returns a URL with // when the container URL ends with a slash

オープン 初心者向け
#3,495 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@ShivamSharma43 がすでに取り組んでいます。

2026年10月23日 から。

  • #3497 @ShivamSharma43 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
azure, python
領域
backend, cloud

調査の方向性

AzureBlobStorageTarget._send_prompt_to_target_async と _parse_url を読みます。issue では、これらが URL の構築とアップロードの解析を行う箇所として示されています。末尾が / のコンテナー URL と、フォルダーのプレフィックスがある URL の提供されたケースで再現します。アップロードされた blob の名前と返される URL の両方が期待される結果と一致し、スラッシュが二重にならなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

AzureBlobStorageTarget._send_prompt_to_target_async builds the returned URL by appending to the configured container URL:

blob_url = self._container_url + "/" + file_name

When container_url (or AZURE_STORAGE_ACCOUNT_CONTAINER_URL) ends with /, for example https://acct.blob.core.windows.net/xpia/, the URL gets // before the file name. The upload goes through _parse_url, which ignores the empty segment, so the blob is uploaded as doc.txt. The returned URL .../xpia//doc.txt names a blob /doc.txt, which does not exist, so anything that uses the returned URL (for example the XPIA workflows) points at a missing blob.

With a folder prefix and a trailing slash (.../xpia/folder/), _parse_url returns the prefix folder/, so the blob itself is uploaded as folder//doc.txt instead of folder/doc.txt.

Steps/Code to Reproduce
import asyncio
from unittest.mock import AsyncMock, MagicMock, patch

from pyrit.setup import IN_MEMORY, initialize_pyrit_async


async def main():
    await initialize_pyrit_async(memory_db_type=IN_MEMORY)

    from pyrit.models import Message, MessagePiece
    from pyrit.prompt_target import AzureBlobStorageTarget

    for container_url in ["https://acct.blob.core.windows.net/xpia/", "https://acct.blob.core.windows.net/xpia/folder/"]:
        target = AzureBlobStorageTarget(container_url=container_url, sas_token="sv=test")
        client = AsyncMock()
        client.get_blob_client = MagicMock(return_value=AsyncMock(exists=AsyncMock(return_value=False)))
        piece = MessagePiece(role="user", original_value="payload", prompt_metadata={"file_name": "doc.txt"})

        with patch("azure.storage.blob.aio.ContainerClient.from_container_url", return_value=client):
            response = await target.send_prompt_async(message=Message(message_pieces=[piece]))

        print("container_url:", container_url)
        print("  uploaded blob:", client.get_blob_client.call_args.kwargs["blob"])
        print("  returned URL :", response[0].get_value())


asyncio.run(main())
Expected Results

The trailing slash makes no difference:

container_url: https://acct.blob.core.windows.net/xpia/
  uploaded blob: doc.txt
  returned URL : https://acct.blob.core.windows.net/xpia/doc.txt
container_url: https://acct.blob.core.windows.net/xpia/folder/
  uploaded blob: folder/doc.txt
  returned URL : https://acct.blob.core.windows.net/xpia/folder/doc.txt
Actual Results

The returned URL does not match the uploaded blob, and the prefixed blob gets an empty path segment:

container_url: https://acct.blob.core.windows.net/xpia/
  uploaded blob: doc.txt
  returned URL : https://acct.blob.core.windows.net/xpia//doc.txt
container_url: https://acct.blob.core.windows.net/xpia/folder/
  uploaded blob: folder//doc.txt
  returned URL : https://acct.blob.core.windows.net/xpia/folder//doc.txt
Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (eeb9ba9d) in editable mode
主要言語
Python
スター
4.6k
フォーク
962
平均マージ
2日 13時間
マージ済み PR(30日)
417

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。