mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
fix(naver-import): address PR #495 review issues
- SSRF: validate user-supplied URLs with checkSsrf() before fetch in both importNaverList and importGoogleList; upgrade naver.me substring check to exact hostname comparison to prevent bypass - i18n: add missing places.importNaverList key to de.ts and es.ts - migration: switch Naver addon seed to INSERT OR IGNORE to preserve admin customizations on re-runs; restore budget_category_order CREATE TABLE to its original formatting - route: remove redundant cast after type-narrowing guard in naver-list handler - component: hoist provider ternary above try/catch in handleListImport - tests: add four new Naver import cases (502, empty list, no-coords, canonical URL skipping redirect fetch)
This commit is contained in:
@@ -86,8 +86,8 @@ const PlacesSidebar = React.memo(function PlacesSidebar({
|
||||
const handleListImport = async () => {
|
||||
if (!listImportUrl.trim()) return
|
||||
setListImportLoading(true)
|
||||
const provider = listImportProvider === 'naver' && isNaverListImportEnabled ? 'naver' : 'google'
|
||||
try {
|
||||
const provider = listImportProvider === 'naver' && isNaverListImportEnabled ? 'naver' : 'google'
|
||||
const result = provider === 'google'
|
||||
? await placesApi.importGoogleList(tripId, listImportUrl.trim())
|
||||
: await placesApi.importNaverList(tripId, listImportUrl.trim())
|
||||
@@ -105,7 +105,6 @@ const PlacesSidebar = React.memo(function PlacesSidebar({
|
||||
})
|
||||
}
|
||||
} catch (err: any) {
|
||||
const provider = listImportProvider === 'naver' && isNaverListImportEnabled ? 'naver' : 'google'
|
||||
toast.error(err?.response?.data?.error || t(provider === 'google' ? 'places.googleListError' : 'places.naverListError'))
|
||||
} finally {
|
||||
setListImportLoading(false)
|
||||
|
||||
@@ -899,6 +899,7 @@ const de: Record<string, string | { name: string; category: string }[]> = {
|
||||
'places.gpxError': 'GPX-Import fehlgeschlagen',
|
||||
'places.importList': 'Listenimport',
|
||||
'places.importGoogleList': 'Google Liste',
|
||||
'places.importNaverList': 'Naver Liste',
|
||||
'places.googleListHint': 'Geteilten Google Maps Listen-Link einfügen, um alle Orte zu importieren.',
|
||||
'places.googleListImported': '{count} Orte aus "{list}" importiert',
|
||||
'places.googleListError': 'Google Maps Liste konnte nicht importiert werden',
|
||||
|
||||
@@ -870,6 +870,7 @@ const es: Record<string, string> = {
|
||||
'places.gpxError': 'Error al importar GPX',
|
||||
'places.importList': 'Importar lista',
|
||||
'places.importGoogleList': 'Lista Google',
|
||||
'places.importNaverList': 'Lista Naver',
|
||||
'places.googleListHint': 'Pega un enlace compartido de una lista de Google Maps para importar todos los lugares.',
|
||||
'places.googleListImported': '{count} lugares importados de "{list}"',
|
||||
'places.googleListError': 'Error al importar la lista de Google Maps',
|
||||
|
||||
Reference in New Issue
Block a user