Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,10 @@ class UploadPlaceViewModel @Inject constructor(
onSuccess:() -> Unit,
imageList: List<String> = emptyList()
) = intent {
// 지번 주소가 없으면 도로명 주소, 도로명 주소도 없으면 서버에 빈 문자열 전송
uploadRepository.submitUploadPlace(
spotName = state.selectedSpotByMap?.title ?: "",
address = state.selectedSpotByMap?.address ?: "",
address = state.selectedSpotByMap?.address ?: state.selectedSpotByMap?.roadAddress ?: "",
spotType = state.selectedSpotType ?: SpotType.CAFE,
Comment on lines +349 to 353
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

빈 주소 처리 미흡: 빈 문자열("")일 때 도로명 주소로 대체되지 않습니다

현재 로직은 null만 처리해 Elvis가 동작합니다. address=""(혹은 공백)인 경우 그대로 ""가 전송되어 요구사항(비어있으면 roadAddress, 둘 다 비면 빈 문자열)과 불일치합니다. 공백 포함 빈값까지 처리하도록 수정이 필요합니다.

-            address = state.selectedSpotByMap?.address ?: state.selectedSpotByMap?.roadAddress ?: "",
+            address = state.selectedSpotByMap?.address?.takeUnless { it.isBlank() }
+                ?: state.selectedSpotByMap?.roadAddress?.takeUnless { it.isBlank() }
+                ?: "",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// 지번 주소가 없으면 도로명 주소, 도로명 주소도 없으면 서버에 빈 문자열 전송
uploadRepository.submitUploadPlace(
spotName = state.selectedSpotByMap?.title ?: "",
address = state.selectedSpotByMap?.address ?: "",
address = state.selectedSpotByMap?.address ?: state.selectedSpotByMap?.roadAddress ?: "",
spotType = state.selectedSpotType ?: SpotType.CAFE,
// 지번 주소가 없으면 도로명 주소, 도로명 주소도 없으면 서버에 빈 문자열 전송
uploadRepository.submitUploadPlace(
spotName = state.selectedSpotByMap?.title ?: "",
address = state.selectedSpotByMap?.address?.takeUnless { it.isBlank() }
?: state.selectedSpotByMap?.roadAddress?.takeUnless { it.isBlank() }
?: "",
spotType = state.selectedSpotType ?: SpotType.CAFE,
🤖 Prompt for AI Agents
In
feature/upload/src/main/java/com/acon/acon/feature/upload/screen/UploadPlaceViewModel.kt
around lines 349 to 353, the current Elvis operator only handles nulls so an
empty or whitespace-only address ("" or "  ") will be sent as-is; update the
logic to treat blank strings as missing by using isNullOrBlank checks (e.g.,
prefer selectedSpotByMap?.address.takeIf { !it.isNullOrBlank() } ?:
selectedSpotByMap?.roadAddress.takeIf { !it.isNullOrBlank() } ?: "") so the code
sends the roadAddress when address is blank and otherwise falls back to empty
string.

featureList = state.featureList ?: emptyList(),
recommendedMenu = state.recommendMenu ?: "",
Expand Down