(mime-parse-multipart): Change media-type of entity to
authormorioka <morioka>
Sun, 28 Jun 1998 22:17:24 +0000 (22:17 +0000)
committermorioka <morioka>
Sun, 28 Jun 1998 22:17:24 +0000 (22:17 +0000)
application/octet-stream if the first delimiter is not found.

mime-parse.el

index 7e0edf5..b198b96 100644 (file)
@@ -166,9 +166,7 @@ If is is not found, return DEFAULT-ENCODING."
            (make-mime-content-type 'text 'plain)
            ))
         (header-end (mime-entity-header-end-internal entity))
-        (body-end (mime-entity-body-end-internal entity))
-        (node-id (mime-entity-node-id-internal entity))
-        cb ce ret ncb children (i 0))
+        (body-end (mime-entity-body-end-internal entity)))
     (save-restriction
       (goto-char body-end)
       (narrow-to-region header-end
@@ -176,30 +174,36 @@ If is is not found, return DEFAULT-ENCODING."
                            (match-beginning 0)
                          body-end))
       (goto-char header-end)
-      (re-search-forward rsep nil t)
-      (setq cb (match-end 0))
-      (while (re-search-forward rsep nil t)
-       (setq ce (match-beginning 0))
-       (setq ncb (match-end 0))
-       (save-restriction
-         (narrow-to-region cb ce)
-         (setq ret (mime-parse-message dc-ctl (cons i node-id)
-                                       representation-type))
-         )
-       (setq children (cons ret children))
-       (goto-char (setq cb ncb))
-       (setq i (1+ i))
-       )
-      (setq ce (point-max))
-      (save-restriction
-       (narrow-to-region cb ce)
-       (setq ret (mime-parse-message dc-ctl (cons i node-id)
-                                     representation-type))
-       )
-      (setq children (cons ret children))
-      )
-    (mime-entity-set-children-internal entity (nreverse children))
-    entity))
+      (if (re-search-forward rsep nil t)
+         (let ((cb (match-end 0))
+               ce ncb ret children
+               (node-id (mime-entity-node-id-internal entity))
+               (i 0))
+           (while (re-search-forward rsep nil t)
+             (setq ce (match-beginning 0))
+             (setq ncb (match-end 0))
+             (save-restriction
+               (narrow-to-region cb ce)
+               (setq ret (mime-parse-message dc-ctl (cons i node-id)
+                                             representation-type))
+               )
+             (setq children (cons ret children))
+             (goto-char (setq cb ncb))
+             (setq i (1+ i))
+             )
+           (setq ce (point-max))
+           (save-restriction
+             (narrow-to-region cb ce)
+             (setq ret (mime-parse-message dc-ctl (cons i node-id)
+                                           representation-type))
+             )
+           (setq children (cons ret children))
+           (mime-entity-set-children-internal entity (nreverse children))
+           )
+       (mime-entity-set-content-type-internal
+        entity (make-mime-content-type 'application 'octet-stream))
+       )))
+  entity)
 
 (defun mime-parse-encapsulated (entity)
   (mime-entity-set-children-internal