It is by design, please read documentation:
I.e. If there is not slash in mask, it is matched only against the last path component. If there is slash, all before the slash is matched against the whole path except for its last component.
When the mask selects files and it makes sense to select them based on directory, you can extend the mask with path mask. Separate path mask from filename mask by slash.
I.e. If there is not slash in mask, it is matched only against the last path component. If there is slash, all before the slash is matched against the whole path except for its last component.