dubeejw commented on a change in pull request #2847: Treat action code as 
attachments for created/updated actions
URL: 
https://github.com/apache/incubator-openwhisk/pull/2847#discussion_r168212354
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/entity/Exec.scala
 ##########
 @@ -122,19 +124,24 @@ protected[core] case class 
CodeExecMetaDataAsString(manifest: RuntimeManifest) e
 
 protected[core] case class CodeExecAsAttachment(manifest: RuntimeManifest,
                                                 override val code: 
Attachment[String],
-                                                override val entryPoint: 
Option[String])
+                                                override val entryPoint: 
Option[String],
+                                                override val binary: Boolean = 
false)
     extends CodeExec[Attachment[String]] {
   override val kind = manifest.kind
   override val image = manifest.image
   override val sentinelledLogs = manifest.sentinelledLogs.getOrElse(true)
   override val deprecated = manifest.deprecated.getOrElse(false)
   override val pull = false
-  override lazy val binary = true
   override def codeAsJson = code.toJson
 
   def inline(bytes: Array[Byte]): CodeExecAsAttachment = {
-    val encoded = new String(bytes, StandardCharsets.UTF_8)
-    copy(code = Inline(encoded))
+    val code = new String(bytes, StandardCharsets.UTF_8)
+
+    if (kind == "java" && !Exec.isBinaryCode(code)) {
 
 Review comment:
   Allows backward compatibility with old Java actions that have attachments 
that are not base64.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to