BatchRequestItem keeps the absolute URL, and set_url() only matches //v1.0/
まだ誰も着手していません。
評価
調査の方向性
msgraph_core/requests/batch_request_item.py から始め、API_VERSION_REGEX、init、set_url() に焦点を当てます。リンクされた 1.5.1 gist で動作を再現し、BatchRequestItem がシリアライズされた batch body 内で /v1.0 または /beta のプレフィックスを含まない相対 URL を生成することを確認します。
索引モデルが issue の本文から書いたものです。
説明
BatchRequestItem built from a RequestInformation keeps the full https://graph.microsoft.com/v1.0/... URL, so the serialized batch body sends absolute URLs. set_url() is meant to strip the version prefix but its regex can't match a normal URL:
msgraph_core/requests/batch_request_item.py on main, same in 1.5.1 (and back to 1.3.8):
- line 24:
API_VERSION_REGEX = re.compile(r'/\/(v1.0|beta)/'), both/and\/are literal slashes in Python, so it only matches//v1.0/. Looks like a JavaScript regex literal ported as-is. - line 50:
__init__keepsrequest_information.urlafter the me-token replace, never callsset_url. - lines 101-127:
set_url()uses the regex above, so it never strips the version either.
Repro on 1.5.1: https://gist.github.com/HardMax71/156fbbad8a0ba78a789970a8ee550824
msgraph-core 1.5.1 kiota-abstractions 1.12.0
after __init__ url = 'https://graph.microsoft.com/v1.0/me'
after set_url() url = '/v1.0/me'
API_VERSION_REGEX = /\/(v1.0|beta)/
regex matches '/v1.0/me'? False | matches '//v1.0/me'? True
serialized batch body: {"requests": [{"id": "m1", "method": "POST", "url": "https://graph.microsoft.com/v1.0/users/u1/messages/m1/move", ...}]}
Three-line fix: API_VERSION_REGEX = re.compile(r'/(v1\.0|beta)(?=/|$)'), and in __init__ replace the manual assignment with self.set_url(request_information.url) (it already handles the me-token, query string and fragment). We currently strip the prefix by hand before building items.
- 主要言語
- Python
- スター
- 288
- フォーク
- 52
- 平均マージ
- 8時間 10分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoftgraph/msgraph-sdk-python-core のほかの issue
-
status:waiting-for-triage type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
status:waiting-for-triage type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoftgraph/msgraph-sdk-python-core#1030 · コメント 2 件 · リアクション 4 件 ·
-
status:waiting-for-triage type:feature
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
-
status:waiting-for-triage type:bug
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
status:waiting-for-triage
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
microsoftgraph/msgraph-sdk-python-core#935 · リアクション 1 件 ·
microsoftgraph/msgraph-sdk-python-core の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100