def remove_tag_from_name(name, tag):
    """Removes a tag from a name given as a string."""
    name = name.split("/")[-1].split(".")[0]
    if name == tag:
        return tag
    else:
        return name.replace(tag, "")