Split a name longer than 100 chars into a prefix and a name part.
(self, name, encoding, errors)
| 1140 | return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf-8") |
| 1141 | |
| 1142 | def _posix_split_name(self, name, encoding, errors): |
| 1143 | """Split a name longer than 100 chars into a prefix |
| 1144 | and a name part. |
| 1145 | """ |
| 1146 | components = name.split("/") |
| 1147 | for i in range(1, len(components)): |
| 1148 | prefix = "/".join(components[:i]) |
| 1149 | name = "/".join(components[i:]) |
| 1150 | if len(prefix.encode(encoding, errors)) <= LENGTH_PREFIX and \ |
| 1151 | len(name.encode(encoding, errors)) <= LENGTH_NAME: |
| 1152 | break |
| 1153 | else: |
| 1154 | raise ValueError("name is too long") |
| 1155 | |
| 1156 | return prefix, name |
| 1157 | |
| 1158 | @staticmethod |
| 1159 | def _create_header(info, format, encoding, errors): |
no test coverage detected