Get the owner of an asset folder via ecmascript



I have a workflow that is launched whenever a new file is uploaded to the dam. Each folder in the dam should either have an assigned owner, or should be able to find an owner by traversing up the directory path. That owner(s) are sent a notification to approve the new file. Since i know the path of the directory, I know i can infer who the owner group is with "mac-default-<folder name>-owner". But this falls apart if multiple folders have the same name, as the duplicate folder would have the owner group "mac-default-<folder name>1-owner", and i won't know which user group applies to the given folder.

Is there a more certain way to find the owner using ecmascript to be run by the workflow?