• Mahmoud Aglan's avatar
    fix(expenses): read the upload's metadata before store() moves it away · 7622238b
    Mahmoud Aglan authored
    This is the actual reason no receipt could be attached — 1b62a44f-… and
    every other support code from the expense pages:
    
        UnableToRetrieveMetadata: Unable to retrieve the file_size for file
        at location: livewire-tmp/adbO73…jpg
        ExpenseShow.php(93): TemporaryUploadedFile->getSize()
    
    store() moves the file out of livewire-tmp. The attachment array put
    'path' => $file->store(…) on its first line, and PHP evaluates array
    literals in order, so getMimeType() and getSize() on the lines below ran
    against a path that had just stopped existing. Validation passed, the
    vanished-upload guard passed, the file was even written to its final
    home — and then the request died with a 500 on the way to the row.
    Nothing was ever saved.
    
    Both handlers now read name, mime and size into locals first and store
    last. Reproduced against a real local disk before and after; Livewire's
    test harness swaps in a temp disk that does not move the file, which is
    why a component test would have gone green on the broken code, so the
    regression guard asserts the source ordering instead.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    7622238b
Name
Last commit
Last update
..
CouponValidator.php Loading commit data...
ExpenseForm.php Loading commit data...
ExpenseList.php Loading commit data...
ExpenseShow.php Loading commit data...
ExternalRevenueForm.php Loading commit data...
FacilityRentForm.php Loading commit data...
FacilityRentList.php Loading commit data...
FinancialOverview.php Loading commit data...
PaymentPlanCreate.php Loading commit data...
PaymentProofQueue.php Loading commit data...
TransferReconciliation.php Loading commit data...