fix: Unable to publish helm package (OD-2570)

This commit is contained in:
Robin Shen 2025-09-29 19:54:36 +08:00
parent d8cdd0e327
commit c0c8c585c1
3 changed files with 19 additions and 15 deletions

View File

@ -136,6 +136,24 @@ public class VersionedYamlDoc extends MappingNode {
return constructDocument(node);
}
protected Object constructObject(Node node) {
if (node instanceof MappingNode) {
MappingNode mappingNode = (MappingNode) node;
for (var it = mappingNode.getValue().iterator(); it.hasNext();) {
var tuple = it.next();
if (tuple.getKeyNode() instanceof ScalarNode) {
ScalarNode keyNode = (ScalarNode) tuple.getKeyNode();
if ("type".equals(keyNode.getValue())) {
String implementationName = ((ScalarNode) tuple.getValueNode()).getValue();
mappingNode.setTag(new Tag("!" + implementationName));
it.remove();
}
}
}
}
return super.constructObject(node);
}
@Override
protected String constructScalar(ScalarNode node) {
String value = super.constructScalar(node);

View File

@ -242,20 +242,6 @@ public abstract class BaseConstructor {
* @return Java instance
*/
protected Object constructObject(Node node) {
if (node instanceof MappingNode) {
MappingNode mappingNode = (MappingNode) node;
for (var it = mappingNode.getValue().iterator(); it.hasNext();) {
var tuple = it.next();
if (tuple.getKeyNode() instanceof ScalarNode) {
ScalarNode keyNode = (ScalarNode) tuple.getKeyNode();
if ("type".equals(keyNode.getValue())) {
String implementationName = ((ScalarNode) tuple.getValueNode()).getValue();
mappingNode.setTag(new Tag("!" + implementationName));
it.remove();
}
}
}
}
if (constructedObjects.containsKey(node)) {
return constructedObjects.get(node);
}

View File

@ -113,7 +113,7 @@ public class GemPackService implements PackService {
sessionManager.run(() -> {
checkProject(projectId, true);
});
var tempFile = FileUtils.createTempFile("upload", "nuget");
var tempFile = FileUtils.createTempFile("upload", "gem");
try {
try (var os = new BufferedOutputStream(new FileOutputStream(tempFile), BUFFER_SIZE)) {
IOUtils.copy(request.getInputStream(), os);