Skip to content

Fix error when uploading file via api #12

Description

@trk

When i try to add image(s) via api getting this error. When i check what i have on $event->arguments(0) its filename of image file.

Fix: Warning: Attempt to read property "id" on string

$pageid = $event->arguments(0)->id;

$arg = $event->arguments(0);
if (is_string($arg) && strpos($arg, '/') !== false) {
    $pageid = basename(dirname($arg));
} else {
    $pageid = $arg->id;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions