fix target creation for public links

fix #11645

PR against stable7 because master is in transition to a different implementation.

cc @PVince81 
Are we sure this will never be SHARE_TYPE_GROUP ?