fix(qa): ISSUE-001 — SKU prices 404 for SKUs containing slashes
SKUs with forward slashes (e.g. 0V2071/250159/250158) caused a 404
on /api/mappings/{sku}/prices because path separators in the SKU
were interpreted as URL path segments. Changed to query parameter.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -146,8 +146,8 @@ async def create_batch_mapping(data: MappingBatchCreate):
|
|||||||
return {"success": False, "error": str(e)}
|
return {"success": False, "error": str(e)}
|
||||||
|
|
||||||
|
|
||||||
@router.get("/api/mappings/{sku}/prices")
|
@router.get("/api/mappings/prices")
|
||||||
async def get_mapping_prices(sku: str):
|
async def get_mapping_prices(sku: str = Query(...)):
|
||||||
"""Get component prices from crm_politici_pret_art for a kit SKU."""
|
"""Get component prices from crm_politici_pret_art for a kit SKU."""
|
||||||
app_settings = await sqlite_service.get_app_settings()
|
app_settings = await sqlite_service.get_app_settings()
|
||||||
id_pol = int(app_settings.get("id_pol") or 0) or None
|
id_pol = int(app_settings.get("id_pol") or 0) or None
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ async function loadKitPrices(sku, container) {
|
|||||||
if (spinner) spinner.style.display = '';
|
if (spinner) spinner.style.display = '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/mappings/${encodeURIComponent(sku)}/prices`);
|
const res = await fetch(`/api/mappings/prices?sku=${encodeURIComponent(sku)}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
if (spinner) spinner.innerHTML = `<small class="text-danger">${esc(data.error)}</small>`;
|
if (spinner) spinner.innerHTML = `<small class="text-danger">${esc(data.error)}</small>`;
|
||||||
|
|||||||
@@ -159,5 +159,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ request.scope.get('root_path', '') }}/static/js/mappings.js?v=13"></script>
|
<script src="{{ request.scope.get('root_path', '') }}/static/js/mappings.js?v=14"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user