### Godot version

4.1.1

### System information

linux

### Issue description

- When favoriting a path in a `FileDialog`, clicking on it travels to `path/to/dir/`.
- When going up a level from there, it doesn't go to `path/to` but to `path/to/dir` (without the `/`).

[simplescreenrecorder-2023-08-18_09.38.37.webm](https://github.com/godotengine/godot/assets/71937306/00c20ad3-292f-4961-84ed-dbc64906df52)

The problem is either (or both) that:
 - loaded path has a trailing `/`
 - parent dir of `stuff/` is considered to be `stuff`

### Steps to reproduce

favorite a directory and use the feature to navigate to it

### Minimal reproduction project

any (i.e. the project manager's "new project" dialog has one)
l = memnew(Label(TTR("File:")));
	l->set_theme_type_variation("HeaderSmall");
	file_box->add_child(l);
	file = memnew(LineEdit);
	file->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE);
	file->set_stretch_ratio(4);
	file->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	file_box->add_child(file);
	filter = memnew(OptionButton);
	filter->set_stretch_ratio(3);
	filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	filter->set_clip_text(true); 
	file_box->add_child(filter);
	file_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	item_vb->add_child(file_box);
	dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	_update_drives();
	connect("confirmed", callable_mp(this, &EditorFileDialog::_action_pressed));
	item_list->connect("item_selected", callable_mp(this, &EditorFileDialog::_item_selected), CONNECT_DEFERRED);
	item_list->connect("multi_selected", callable_mp(this, &EditorFileDialog::_multi_selected), CONNECT_DEFERRED);
	item_list->connect("item_activated", callable_mp(this, &EditorFileDialog::_item_dc_selected).bind());
	item_list->connect("empty_clicked", callable_mp(this, &EditorFileDialog::_items_clear_selection));
	dir->connect("text_submitted", callable_mp(this, &EditorFileDialog::_dir_submitted));
	file->connect("text_submitted", callable_mp(this, &EditorFileDialog::_file_submitted));
	filter->connect("item_selected", callable_mp(this, &EditorFileDialog::_filter_selected));
	confirm_save = memnew(ConfirmationDialog);
	add_child(confirm_save);
	confirm_save->connect("confirmed", callable_mp(this, &EditorFileDialog::_save_confirm_pressed));
	dep_remove_dialog = memnew(DependencyRemoveDialog);
	add_child(dep_remove_dialog);