Only trim the defined extension when present