wp-papi/papi

File property: notice undefined property

nlemoine opened this issue · 3 comments

Description

Undefined property notice.

Steps to reproduce

  • Add a file property
  • Load and select a file (an mp4 video in my case, don't know if it matters)
  • Save

Page should now show a notice mentioning "undefined property on line 187" (in 3.1.18, line 185 on master) because, for a reason I didn't check, file isn't set.

What versions of softwares are you using?

  • Papi: 3.1.18
  • WordPress: 4.7.2

Hm. Can't reproduce this with a image file or a excel file. But we can add a check that checks if file->file exists before it's used.

I checked again, this issue happens with an mp4 file. You can download a sample one here.

Looks like the file property value isn't set on some files, since basename works with urls we can just set file property value to url and get the same output.