Skip to content

Commit a05fccd

Browse files
committed
PC-82: Fix file upload in fetchService.js when file has no name
1 parent a306678 commit a05fccd

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

app/javascript/components/services/fetchService.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ export const fetchCustomers = {
2222
const response = await fetch(customer.logo_url)
2323

2424
if (response.ok) {
25+
const contentType = response.headers.get("Content-Type")
2526
const blob = await response.blob()
26-
formData.append('customer[logo]', blob)
27+
const fileName = `logo.${contentType.split("/")[1] || "png"}`
28+
29+
formData.append('customer[logo]', blob, fileName)
2730
} else {
2831
throw new Error('Failed to fetch logo')
2932
}

app/javascript/components/ui/PcDropdownSelect.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const PcDropdownSelect = ({
3232
options={options}
3333
placeholder={placeholder}
3434
filterBy={handleFilterBy}
35-
allowNew={false}
35+
allowNew
3636
newSelectionPrefix="Add new customer: "
3737
className={`${hasIcon ? isMenuOpen ? 'pc-typeahead-arrow-up' : 'pc-typeahead-arrow-down' : ''} border border-primary rounded-1`}
3838
style={{ height }}

0 commit comments

Comments
 (0)