Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbeaver/pro#2795 Editors for objects under a path with special symbols don't get restored #29993

Merged
merged 20 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6270dad
dbeaver/pro#2795 Editors for objects under a path with special symbols
serjiokov May 8, 2024
25157b2
dbeaver/pro#2795 Editors for objects under a path with special symbols
serjiokov May 8, 2024
c2523c0
Merge branch 'devel' into dbeaver/pro#2795-editor-restore-path
serjiokov May 8, 2024
bc0e1c6
dbeaver/pro#2795 Extracted to upper method
serjiokov May 8, 2024
bc14ea6
Merge branch 'dbeaver/pro#2795-editor-restore-path' of git@github.com…
serjiokov May 8, 2024
e779148
Merge branch 'dbeaver/pro#2795-editor-restore-path' of
serjiokov May 8, 2024
148bdc3
dbeaver/pro#2795-editor-restore-path - normalize - to - denormalize
serjiokov May 8, 2024
5de71dc
dbeaver/pro#2795-editor-restore-path Minor
serjiokov May 8, 2024
577ddd2
dbeaver/pro#2795-editor-restore-path Remane method
serjiokov May 8, 2024
9fefcd8
dbeaver/pro#2795-editor-restore-path decode from any Ascii code to
serjiokov May 9, 2024
d156def
dbeaver/pro#2795 Check before decode
serjiokov May 10, 2024
12c6b14
dbeaver/pro#2795 Illigal argument of "%"
serjiokov May 10, 2024
2cbc3e9
dbeaver/pro#2795 Fixed encoding/ decoding of path segment
serjiokov May 10, 2024
736c589
dbeaver/pro#2795 Fixed encoding/ decoding of path segment
serjiokov May 10, 2024
226a2c5
dbeaver/pro#2795 Removed constant
serjiokov May 10, 2024
3773339
Merge branch 'dbeaver/pro#2795-editor-restore-path' of git@github.com…
serjiokov May 10, 2024
0b70e2e
Merge branch 'dbeaver/pro#2795-editor-restore-path' of
serjiokov May 10, 2024
f9180ff
Merge branch 'devel' into dbeaver/pro#2795-editor-restore-path
serjiokov May 10, 2024
9bbe064
dbeaver/pro#2795 - Unrelated changes
serjiokov May 13, 2024
863e777
Merge branch 'dbeaver/pro#2795-editor-restore-path' of git@github.com…
serjiokov May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public DBNNode getNodeByPath(
log.debug("Project node not found");
return null;
}
final NodePath nodePath = getNodePath(path);
NodePath nodePath = DBNUtils.deNormalizeNodePath(getNodePath(path));
if (nodePath.legacyFormat) {
return DBNLegacyUtils.legacyGetNodeByPath(monitor, projectNode, nodePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public final String getNodeUri() {
if (!pathBuilder.isEmpty()) {
pathBuilder.insert(0, '/');
}
String nodeId = currentNode.getNodeId().replace("/", DBNModel.SLASH_ESCAPE_TOKEN);
String nodeId = DBNUtils.normailizeNodePath(currentNode.getNodeId());
if (currentNode instanceof DBNResource && currentNode.getParentNode() instanceof DBNProject) {
//FIXME: remove after migration to the real resource root node
nodeId = DBNResource.FAKE_RESOURCE_ROOT_NODE + "/" + nodeId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jkiss.dbeaver.model.app.DBPProject;
import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import org.jkiss.dbeaver.model.exec.DBCExecutionContextDefaults;
import org.jkiss.dbeaver.model.navigator.DBNModel.NodePath;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant import

import org.jkiss.dbeaver.model.navigator.meta.DBXTreeFolder;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
Expand Down Expand Up @@ -269,4 +270,31 @@ public boolean has(String name) {
};
}


/**
* The method replace '%2F' to '/' symbol
*
* @param nodePath - path
* @return - node path object
*/
public static NodePath deNormalizeNodePath(@NotNull NodePath nodePath) {
List<String> normalizedPathItems = new ArrayList<>();
for (String item : nodePath.pathItems) {
normalizedPathItems.add(item.replace(DBNModel.SLASH_ESCAPE_TOKEN, "/"));
}
nodePath.pathItems = normalizedPathItems;
return nodePath;
}

/**
* The method replace '/' to '%2F' symbol
*
* @param path - path
* @return - string path segment
*/
public static String normailizeNodePath(@NotNull String path) {
return path.replace("/", DBNModel.SLASH_ESCAPE_TOKEN);
}


}