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