Maybe it would make sense to get the fileUrl handling into a seperate pure JS class and re-use it in kml and wms (and possibly others in the future). There's a good amount of copied code which contradicts the DRY principle. I didn't look into detail and can't tell how easy it would be.

It probably only makes sense after it's merged together with kml import. Maybe open an issue for that?