resolvePath method

String resolvePath(
  1. String issueIdentifier
)

Resolves the workspace path for issueIdentifier without creating it.

Implementation

String resolvePath(String issueIdentifier) {
  final key = sanitizeKey(issueIdentifier);
  if (key.isEmpty) {
    throw const WorkspaceException(
      WorkspaceFailureCode.emptyKey,
      'Workspace key resolved to an empty string after sanitization.',
    );
  }
  final candidate = p.normalize(p.join(workspaceConfig.root, key));
  final root = p.normalize(workspaceConfig.root);
  if (!p.isWithin(root, candidate) && candidate != root) {
    throw WorkspaceException(
      WorkspaceFailureCode.pathEscape,
      'Workspace path $candidate escapes root $root.',
    );
  }
  return candidate;
}