I don't believe `loc` is a course location; thus, `loc.name` is not the run name for the course. If it is a course, then use `loc.course_id` (which also checks whether loc is a course to ensure that name is actually meaningful).

If the url coming to the server for the asset doesn't fully specify the course (org, course_id, run_name), we'll need to do much more work to figure out the course :-(